Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-13191

Do Not Create Sort Node with Constant Ordering Expression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • fe, Frontend
    • ghx-label-14

    Description

      Rows are sorted before inserting into partitioned Iceberg tables. See Planner.createPreDmlSort().
      If we update the partitioning column of the table, the sort ordering expression will be the partition column. If we set the new value to a constant (writing only to 1 partition), it will be evaluated as a constant. Therefore the Sort Node will get a constant ordering expression and works unnecessarily ordering indistinct values.
      For example:

      create table ice_part partitioned by spec (l_discount) stored by iceberg tblproperties('format-version'='2') as select * from tpch_parquet.lineitem where l_linenumber=1;
      explain update ice_part set l_discount=0.11 where l_discount>0.07;
      

      The output of explain - the plan - contains a Sort Node with the following ordering expression:

      04:SORT
      |  order by: 0.11 ASC NULLS LAST
      

      It is unnecessary to create a Sort Node to sort rows by a constant ordering expression. Constant expressions should be omitted, just like empty ones.

      Attachments

        Activity

          People

            Unassigned Unassigned
            noemi Noemi Pap-Takacs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: