[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-496402-105":59,"doc-detail-496402-en":130},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","arg-testing-query-rewriters-via-abstract-rule-guided-fuzzing","ARG: Testing Query Rewriters via Abstract Rule - Guided Fuzzing","","Query rewriters transform queries into more efficient yet semantically equivalent forms, but implementing them is error-prone due to rule design, rule interactions, and the need for semantic preservation. Existing DBMS testing methods often target general bug discovery and only cover a limited subset of rewrite scenarios, which can miss critical rewrite bugs. Abstract Rule Guided (ARG) fuzzing uses abstract-rule feedback to generate queries that activate more rewriting logic. ARG tracks covered abstract patterns and dynamically prioritizes unexplored ones, improving bug exposure. Applied to Apache Calcite, WeTune, SQLSolver, and LearnedRewrite, ARG found 38 previously unknown bugs, including crashes, invalid SQL outputs, and semantic deviations, and outperformed SQLsmith and SQLancer in triggering more written rules and bugs.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":40,"@type":76,"position":81},"https://docshare.wps.com/document/research-report/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/arg-testing-query-rewriters-via-abstract-rule-guided-fuzzing/496402/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/arg-testing-query-rewriters-via-abstract-rule-guided-fuzzing/496402.png","ImageObject",300,407,{"name":92,"@type":93},"\tJames","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-04","2026-10-02",true,{"@type":102,"interactionType":103,"userInteractionCount":52},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What problem does ARG address in query rewriters testing?","Question",{"text":112,"@type":113},"ARG targets the challenge that query rewriting is complex and difficult to test systematically, so existing DBMS testing approaches may miss critical rewrite bugs due to limited scenario coverage.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How does ARG use abstract rules to guide query generation?",{"text":117,"@type":113},"ARG uses feedback from abstract rules to track which AST patterns and constraints have been covered, then dynamically prioritizes generating queries that explore uncovered patterns to activate more rewriting logic.",{"name":119,"@type":110,"acceptedAnswer":120},"What were ARG’s key results when tested on popular query rewriters?",{"text":121,"@type":113},"ARG discovered 38 previously unknown bugs across Apache Calcite, WeTune, SQLSolver, and LearnedRewrite, including crashes, invalid SQL outputs, and semantic deviations, with most cases already confirmed.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},496402,1791140738,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":39,"category_name":40,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":52,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":144,"read_time":41,"preview_page_count":19,"preview_urls":145},2336474466412,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","ARG: Testing Query Rewriters via Abstract Rule  \nGuided Fuzzing  \nDawei Li 1,†, Yuxiao Guo 1,†, Qifan Liu 1 , Jie Liang 1,B , Zhiyong Wu2 , Jingzhou Fu2 , Chi Zhang2 , Yu Jiang2  \n1Beihang University, Beijing, China  \n2 KLISS, BNRist, School of Software, Tsinghua University, Beijing, China  \nAbstract—Query rewriters transform a query into a more efficient yet semantically equivalent form, which is vital for optimizing query execution. Despite its importance, query rewriting is inherently complex, influenced by factors including rewrite rule design, rule interactions, and semantic preservation. Consequently, its implementation struggles to prevent problems, which may result in system crashes or incorrect query results. Existing DBMS testing approaches are generally designed for broad bug detection. However, due to the diversity of rewrite rules, they cover only a limited subset of rewrite scenarios, potentially overlooking critical bugs.  \nIn this paper, we propose Abstract Rule Guided (ARG) fuzzing to detect bugs in query rewrites. The key idea is to use feedback from abstract rules to guide query generation, thereby activating more rewriting logic and enhancing bug detection. Abstract rules provide a unified representation of the patterns (e.g., AST structures and related constraints) that trigger rewrites, as well as the resulting transformations. We track abstract rules to identify which patterns have been covered. This feedback is then used to dynamically adjust query generation, prioritizing unexplored patterns to avoid redundancy and expose more rewriting logic. We implemented ARG to test four popular query rewrites, namely Apache Calcite, WeTune, SQLSolver, and LearnedRewrite. ARG discovered 38 previously unknown bugs, consisting of 4 crashes, 13 invalid SQL outputs, and 21 semantic deviations. Among them, 19 have been confirmed, while the remaining cases are still under investigation. We also compared ARG against popular DBMS testing tools. In 24 hours, ARG triggered 76% and 1017% more written rules, triggered 13 and 15 more bugs than SQLsmith and SQLancer, respectively.  \nIndex Terms—Query Rewriter, Rule Feedback, Bug Detection  \nI. INTRODUCTION  \nQuery rewriting is a widely adopted and critically important technique in database management systems (DBMSs) [4],[28] . Many DBMSs employ query rewriters as the logical optimization phase of the query optimization, leveraging equivalence rules to transform complex query statements into more efficient yet semantically equivalent forms [7], [29], [32] . These query rewriters enhance query performance, leading to substantial savings in computational resource costs for enterprises and generating considerable economic benefits.  \nIn practice, query rewriting is inherently complex and variable, requiring the restructuring of query expressions at the  \n†These authors contributed equally to this work and should be considered co-first authors.  \nBJie Liang is the corresponding author.  \nlogical level while preserving semantic equivalence. This process demands not only an accurate understanding of contextual information, but also comprehensive consideration of factors such as data distribution and index availability. Additionally, variations in query languages, nested structures, and evolving business rules further complicate the task. Consequently, rewriter implementations often struggle to prevent bugs: they may occasionally crash during execution. In more complex scenarios, rewritten queries can be invalid, containing syntax or semantic errors, or violate semantic equivalence, resulting in incorrect results.  \nFor example, Figure 1 illustrates a bug in Apache Calcite [3], where the rewritten query produces results that are not semantically equivalent to the original. Specifically, Apache Calcite mistakenly assumes certain columns are uniquely identifying, which leads to incorrect pruning of result sets containing NULL values, thereby violating query semantics. This bug is triggere","cbCaibi6V9Vp33B7","https://ap.wps.com/l/cbCaibi6V9Vp33B7","pdf",2007316,12,"English","# Abstract Rule Guided (ARG) Fuzzing\n## Introduction\n## Example Bug in Apache Calcite\n## Motivation for Rewrite-Specific Testing","[{\"question\":\"What problem does ARG address in query rewriters testing?\",\"answer\":\"ARG targets the challenge that query rewriting is complex and difficult to test systematically, so existing DBMS testing approaches may miss critical rewrite bugs due to limited scenario coverage.\"},{\"question\":\"How does ARG use abstract rules to guide query generation?\",\"answer\":\"ARG uses feedback from abstract rules to track which AST patterns and constraints have been covered, then dynamically prioritizes generating queries that explore uncovered patterns to activate more rewriting logic.\"},{\"question\":\"What were ARG’s key results when tested on popular query rewriters?\",\"answer\":\"ARG discovered 38 previously unknown bugs across Apache Calcite, WeTune, SQLSolver, and LearnedRewrite, including crashes, invalid SQL outputs, and semantic deviations, with most cases already confirmed.\"}]","ARG: Testing Query Rewriters via Abstract Rule - Guided Fuzzing | PDF",1790931749,[146,150,154,158],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/3ebbf1459de2ae2c154dd1f5cc478771.webp",983,1272,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/054ab63d9243c25b4bd2359cf427b52d.webp",982,1270,{"page_no":81,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/cddd861de410c50c7b71674377b046bd.webp",981,1269,{"page_no":19,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/5e86c7549d1c3cd59d705b9322e33caa.webp",980,1268]