a-rafay commented on a change in pull request #2211:
URL: https://github.com/apache/calcite/pull/2211#discussion_r527310512



##########
File path: core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
##########
@@ -6827,6 +6828,62 @@ protected MyProjectRule(Config config) {
         .check();
   }
 
+  /**
+   * Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-4317";>[CALCITE-4317]
+   * RelFieldTrimmer after trimming all the fields in an aggregate
+   * should not return a zero field Aggregate</a>. */
+  @Test void testProjectJoinTransposeRuleOnAggWithNoFieldsWithTrimmer() {

Review comment:
       > Would it be possible to have the test defined in terms of SQL:
   > 
   > ```
   > SELECT name FROM (SELECT count(*) cnt_star, count(empno) cnt_en FROM 
sales.emp)
   > cross join sales.dept limit 10
   > ```
   > 
   > rather than RelBuilder?
   
   I can add a test using the query, but that will only test if we are not 
getting emtpy Agg after trimming. The second issue was to test if the 
ProjectJoinTransposeRule will not throw an exception, which we will not be able 
to test since the resulting RelNode does not match the rule. In our 
environment, we get the transformed node after applying some 
rules/transformation which i was unable to come up with straight from the 
query. Hence i used RelBuilder to start off with the node that will satisfy 
both parts of the ticket. Non-empty agg node after trimming, and firing 
ProjectJoinTransposeRule.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to