zhztheplayer commented on issue #1087: [CALCITE-1172] Add rule to flatten two 
Aggregate operators into one
URL: https://github.com/apache/calcite/pull/1087#issuecomment-480001492
 
 
   Overall I am +1, besides a minor issue (might not be an issue?):
   
   If I test the code correctly, following SQL is still not optimized (bottom 
count has only an empty group set, and subquery is executed on empty table/set):
   
   ```
   select sum(c) from (select count("empid") as c from "hr"."emps" where 
"deptno" < 0)
   ```
   
   I guess this is because following fail condition is a little aggressive:
   
https://github.com/apache/calcite/blob/b5c6e25b131fcfcd5a640641401a8cb61820ad72/core/src/main/java/org/apache/calcite/rel/rules/AggregateMergeRule.java#L121-L123
   
   Could we ensure the optimization happens on such a SQL too? (since it looks 
like a simplest one)

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


With regards,
Apache Git Services

Reply via email to