jinxing64 opened a new pull request #1384: [CALCITE-3256] Add 
ProjectOnProjectToProjectUnifyRule for materialization matching
URL: https://github.com/apache/calcite/pull/1384
 
 
   In current implementation of rules in SubstitutionVisitor.java & 
MaterializedViewSubstitutionVisitor.java, it's quite common to add a 
compensating Project on top of child node of target(MV-rel) during matching. 
But afterwards the next round matching should be able to handle such a 
compensated Project and match upward along the plan tree. Otherwise we fail the 
matching. After all, the goal of matching is to transform the query and let a 
complete 'target' show up in the transformed query plan.
   
   I found cases where the compensated Project cannot be properly handled.
   
   ```
   MV:
   select deptno, sum(salary) + 2, sum(commission)
   from emps
   group by deptno
   
   Query:
   select deptno, sum(salary) + 2
   from emps
   group by deptno
   ```
   After matching of the Aggregates, a compensating Project is added, but 
afterwards matching fails to handle it.

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