jinxing64 opened a new pull request #1377: [CALCITE-3249] 
Substitution#getRexShuttle does not consider RexLiteral
URL: https://github.com/apache/calcite/pull/1377
 
 
   Current `Substitution#getRexShuttle` does not take `RexLiteral` into 
consideration.
   Thus below query & mv fails matching:
   ```
   MV:
   select deptno, sum(salary), sum(commission), sum(k)
   from
     (select deptno, salary, commission, 100 as k
     from emps)
   group by deptno
   
   Query:
   select deptno, sum(salary), sum(k)
   from
     (select deptno, salary, 100 as k
     from emps)
   group by deptno
   ```
   The root cause is that `ProjectToProjectUnifyRule` compensates a `Project` 
which contains `RexLiteral`, but `AggregateOnProjectToAggregateUnifyRule` works 
only when the `Project` in query is a mapping
   
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java#L1357

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to