jin xing created CALCITE-3256:
---------------------------------

             Summary: Add ProjectOnProjectToProjectUnifyRule for 
materialization matching.
                 Key: CALCITE-3256
                 URL: https://issues.apache.org/jira/browse/CALCITE-3256
             Project: Calcite
          Issue Type: Improvement
          Components: core
            Reporter: jin xing
            Assignee: jin xing


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.

{code:java}
MV:
select deptno, sum(salary) + 2, sum(commission)
from emps
group by deptno

Query:
select deptno, sum(salary) + 2
from emps
group by deptno
{code}

After matching of the Aggregates, a compensating Project is added, but 
afterwards matching fails to handle it.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to