You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "jin xing (JIRA)" <ji...@apache.org> on 2019/08/14 08:23:00 UTC

[jira] [Updated] (CALCITE-3249) Substitution#getRexShuttle does not consider RexLiteral

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

jin xing updated CALCITE-3249:
------------------------------
    Description: 
Current {{Substitution#getRexShuttle}} does not take {{RexLiteral}} into consideration.
Thus below query & mv fails matching:

{code:java}
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
{code}

The root cause is that {{ProjectToProjectUnifyRule}} compensate 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

> Substitution#getRexShuttle does not consider RexLiteral
> -------------------------------------------------------
>
>                 Key: CALCITE-3249
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3249
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: jin xing
>            Assignee: jin xing
>            Priority: Minor
>
> Current {{Substitution#getRexShuttle}} does not take {{RexLiteral}} into consideration.
> Thus below query & mv fails matching:
> {code:java}
> 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
> {code}
> The root cause is that {{ProjectToProjectUnifyRule}} compensate 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 message was sent by Atlassian JIRA
(v7.6.14#76016)