Noemi Pap-Takacs created IMPALA-13191:
-----------------------------------------

             Summary: Do Not Create Sort Node with Constant Ordering Expression
                 Key: IMPALA-13191
                 URL: https://issues.apache.org/jira/browse/IMPALA-13191
             Project: IMPALA
          Issue Type: Bug
          Components: fe, Frontend
            Reporter: Noemi Pap-Takacs


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:

{code:java}
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;
{code}

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

{code:java}
04:SORT
|  order by: 0.11 ASC NULLS LAST
{code}

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.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to