You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/09/03 23:30:00 UTC

[jira] [Commented] (CALCITE-4734) If there are duplicate RexNode in MutableCalc, SubstitutionVisitor should return right rebuild RexNode

    [ https://issues.apache.org/jira/browse/CALCITE-4734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17409757#comment-17409757 ] 

Julian Hyde commented on CALCITE-4734:
--------------------------------------

[~yanlin-Lynn], Thanks for reviewing, and especially thanks for getting the contributor to use a meaningful commit message.

> If there are duplicate RexNode in MutableCalc, SubstitutionVisitor should return right rebuild RexNode
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4734
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4734
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Xurenhe
>            Priority: Critical
>              Labels: pull-request-available
>         Attachments: image-2021-08-13-11-43-54-035.png, image-2021-08-13-11-44-09-504.png
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Some user may define some not beautiful mv, but these mv should be worked for rewriting query.
> For example:
> {code:java}
>   @Test void testMoreSameExprInMv() {
>     final String mv = ""
>         + "select \"empid\", \"deptno\", sum(\"empid\") as s1, sum(\"empid\") as s2, count(*) as c\n"
>         + "from \"emps\" group by \"empid\", \"deptno\"";
>     final String query = ""
>         +  "select sum(\"empid\"), count(*) from \"emps\" group by \"empid\", \"deptno\"";
>     sql(mv, query).ok();
>   }
> {code}
> I try debug code to solve this problem.
> I find some bug in 
> {code:java}
> org.apache.calcite.plan.SubstitutionVisitor#getRexShuttle
> {code}
>  !image-2021-08-13-11-43-54-035.png|thumbnail! 
>  !image-2021-08-13-11-44-09-504.png|thumbnail! 
> PR: https://github.com/apache/calcite/pull/2484
> Please review, THX.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)