Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-24335

RelOptMaterialization creates LogicalProject on top of HiveTableScan

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Materialized views
    • Labels:
      None

      Description

      In some cases RelOptMaterialization creates a Project operator on top of materialized view  HiveTableScan.
      Ex.: when some columns need to be casted.

      LogicalProject(empid=[CAST($0):INTEGER NOT NULL], deptno=[$1], name=[$2], salary=[$3], commission=[$4])
        HiveTableScan(table=[[default, mv1_n2]], table:alias=[mv1_n2])
      

      This Project operator is represented by a LogicalProject however a HiveProject should be used.
      Cause: in calcite RelOptMaterialization constructor calls RelOptUtil.createCastRel which uses the RelFactories.DEFAULT_PROJECT_FACTORY
      https://github.com/apache/calcite/blob/987cb7f7da6ff1cb436718ac93868d50e88e875f/core/src/main/java/org/apache/calcite/plan/RelOptMaterialization.java#L60
      https://github.com/apache/calcite/blob/987cb7f7da6ff1cb436718ac93868d50e88e875f/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L832

        Attachments

          Activity

            People

            • Assignee:
              kkasa Krisztian Kasa
              Reporter:
              kkasa Krisztian Kasa
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: