mihaibudiu commented on code in PR #5171:
URL: https://github.com/apache/calcite/pull/5171#discussion_r3751752264


##########
core/src/main/java/org/apache/calcite/rel/rules/JoinAggregateTransposeRule.java:
##########
@@ -106,6 +106,11 @@ protected JoinAggregateTransposeRule(Config config) {
         // in case we decide to extend this rule for lazy aggregation.
         && isAggregateSupported(left, true)
         && groupOutput.contains(info.leftSet())
+        // An aggregate returns one row on empty input if its group set is 
empty.
+        // Pull-up adds group keys and may lose that row. Require the input to 
be
+        // known non-empty.
+        && (!left.getGroupSet().isEmpty()
+            || Boolean.FALSE.equals(mq.isEmpty(left.getInput())))

Review Comment:
   I hope that this is conservative in the right direction: it never answers 
"yes" when it could be empty.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to