This suggestion sounds good, and I agree with the suggestion to stop adding 
test cases to RelOptRulesTest.java. Building on this, should we define a 
directory specifically for adding such test files (e.g., 
core/src/test/java/org/apache/calcite/rel/rules)? And is a PR needed as an 
example?

Best regards,

Zhen Chen

---- Replied Message ----
| From | Stamatis Zampetakis<[email protected]> |
| Date | 2/19/2026 21:53 |
| To | <[email protected]> |
| Subject | [DISCUSS] Stop testing rules inside RelOptRulesTest |
Hi all,

The RelOptRulesTest.java has 12K lines of code and the respective
RelOptRulesTest.xml file has 22K. Wherever we want to add tests for a
specific rule we tend to put it there so inevitably these files are
getting bigger and bigger, navigation becomes harder, conflicts
increase, naming becomes challenging, etc.

From now onwards we could adopt another pattern where the tests for
each new rule (e.g., AggregateFilterMagicRule.java) reside into their
own dedicated testing class (AggregateFilterMagicRuleTest.java) and
XML file (AggregateFilterMagicRuleTest.xml). In other words, we stop
adding tests in RelOptRulesTest.java at least for new rules. Thanks to
the presence of the RelOptFixture class separating tests into
dedicated classes is trivial and boilerplate code that is required for
setting it up (e.g., DiffRepo) is rather minimal.

Let me know your thoughts.

Best,
Stamatis

Reply via email to