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

Canonicalization doesn't do field trimming before materialized view matching

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.23.0
    • Component/s: None

      Description

      If we have query and materialized view as below:

      query:
      LogicalAggregate(group=[{4}], agg#0=[COUNT($3)])
        LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5], DEPTNO=[$7])
          LogicalTableScan(table=[[scott, EMP]])
      
      mv logic:
      LogicalAggregate(group=[{1}], agg#0=[COUNT($0)])
        LogicalProject(SAL=[$5], DEPTNO=[$7])
          LogicalTableScan(table=[[scott, EMP]])
      

      The semantics of query and mv logic are the same. Materialized view matching failed, because field trimming is not done when canonicalizing the plans.

      Currently Calcite does field trimming  when convert sql to rel. But my company's internal system does materialization detection – – generates & transforms & stores the RelNode.

      Shall we add the field trimming when canonicalizing materialized view logic?

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jinxing6042@126.com Jin Xing
              • Votes:
                0 Vote for this issue
                Watchers:
                6 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 - 1h 40m
                  1h 40m