Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3249

Substitution#getRexShuttle does not consider RexLiteral

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.21.0
    • core

    Description

      Current Substitution#getRexShuttle does not take RexLiteral into consideration.
      Thus below query & mv fails matching:

      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
      

      The root cause is that ProjectToProjectUnifyRule compensates 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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jinxing6042@126.com Jin Xing
            jinxing6042@126.com Jin Xing
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h

                Slack

                  Issue deployment