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

FieldTrimmer missing opportunity with SortLimit operators

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 3.0.0
    • CBO
    • None

    Description

      In the following plan, o_col4 is not needed:

      2018-02-11T11:35:14,501 DEBUG [0fda1a20-c7f1-489e-b287-65f35fda9848 main] calcite.sql2rel: Plan after trimming unused fields
      HiveProject(download_volume_bytes=[$0], ri_date=[$1], end_cell_id=[$2], environment=[$3])
        HiveSortLimit(sort0=[$2], dir0=[ASC-nulls-first], fetch=[100])
          HiveProject(download_volume_bytes=[$4], ri_date=[$3], end_cell_id=[$1], environment=[$2], _o__col4=[$0])
            HiveAggregate(group=[{0, 1, 2, 3}], agg#0=[sum($4)])
              HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$0], $f4=[$4])
                HiveProject(ri_date=[$0], imsi=[$1], end_cell_id=[$2], environment=[$3], s1_u_download_data_volume=[$4])
                  HiveTableScan(table=[[default.lsr094]], table:alias=[a])
      

      o_col4 should be removed by the FieldTrimmer. Otherwise, this may prevent MV rewriting to be triggered on some queries containing order by/limit clauses.

      Attachments

        1. HIVE-18680.patch
          3 kB
          jcamachorodriguez
        2. HIVE-18680.01.patch
          275 kB
          jcamachorodriguez

        Activity

          People

            jcamacho Jesús Camacho Rodríguez
            jcamacho Jesús Camacho Rodríguez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: