An Extensible and Verifiable Language for Query Rewrite Rules
Sicheng Pan, Shuxian Wang, Wesley Zheng, Zirong Zeng, Vijay Sharma, Alvin Cheung

TL;DR
Rulescript is a formal, extensible DSL that simplifies writing, verifying, and deploying query rewrite rules across different database engines, reducing engineering effort and bugs.
Contribution
It introduces Rulescript, a formal, engine-agnostic language for query rewrites with automatic correctness verification and easy portability.
Findings
Reimplemented 33 rewrite rules from Apache Calcite using Rulescript.
Successfully deployed rules to CockroachDB and Apache Data Fusion.
Demonstrated minimal effort needed for cross-engine deployment.
Abstract
Logical query plan rewriting transforms a relational database query into an equivalent but more efficient form and is crucial to the performance of database-backed applications. In existing systems, rewrite rules are typically implemented manually, tightly coupled to specific execution engines, and often lack formal correctness guarantees. Consequently, developing a new engine requires reimplementing both legacy and new rules, incurring significant engineering cost, limiting portability, and every new implementation is an opportunity for introducing new bugs. We introduce Rulescript, an engine-agnostic domain-specific language (DSL) for developing query rewrite rules. Rulescript separates rule definition from execution infrastructure via a relational algebra-inspired core language and an explicit decomposition of rules into matching and transformation phases. Developers express…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
