[ 
https://issues.apache.org/jira/browse/CALCITE-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

jin xing updated CALCITE-3256:
------------------------------
    Description: 
In current code, below matching fails:

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

The reason is that --  after matching of the Aggregates, a compensating Project 
is added, but afterwards matching fails to handle it.

This issue proposes to add a rule that match when query and target are both 
Project and query has a compensating Project as a child. After this issue below 
case can be handled:
{code:java}
   query:   Project(projects: [$0, +($1, 2)])
                  Project(projects: [$1, $3, $4])
                   Rel-A
   target:  Project(projects: [$1, +($3, 2)])
                 Rel-A
{code}


  was:
This issue proposes to add a rule to match a project
{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.


> Add ProjectOnProjectToProjectUnifyRule for materialization matching.
> --------------------------------------------------------------------
>
>                 Key: CALCITE-3256
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3256
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: core
>            Reporter: jin xing
>            Assignee: jin xing
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> In current code, below matching fails:
> {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}
> The reason is that --  after matching of the Aggregates, a compensating 
> Project is added, but afterwards matching fails to handle it.
> This issue proposes to add a rule that match when query and target are both 
> Project and query has a compensating Project as a child. After this issue 
> below case can be handled:
> {code:java}
>    query:   Project(projects: [$0, +($1, 2)])
>                   Project(projects: [$1, $3, $4])
>                    Rel-A
>    target:  Project(projects: [$1, +($3, 2)])
>                  Rel-A
> {code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to