[
https://issues.apache.org/jira/browse/HIVE-28725?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Krisztian Kasa reassigned HIVE-28725:
-------------------------------------
Assignee: Krisztian Kasa
> Sorting is performed when order by position is disabled when CBO is enabled
> ---------------------------------------------------------------------------
>
> Key: HIVE-28725
> URL: https://issues.apache.org/jira/browse/HIVE-28725
> Project: Hive
> Issue Type: Bug
> Components: CBO
> Reporter: Krisztian Kasa
> Assignee: Krisztian Kasa
> Priority: Major
> Labels: pull-request-available
>
> Repro steps
> {code:java}
> create table t1 (a int, b int);
> insert into t1 values
> (8, 1),
> (4, 10),
> (6, 3)
> ;
> {code}
> The following query
> {code:java}
> set hive.orderby.position.alias=false;
> set hive.cbo.enable=true;
> select a, b from t1 order by 2;
> {code}
> returns
> {code:java}
> 4 10
> 6 3
> 8 1
> {code}
> So the result is ordered by the first column.
> However when CBO is off it returns
> {code:java}
> set hive.orderby.position.alias=false;
> set hive.cbo.enable=false;
> select a, b from t1 order by 2;
> 8 1
> 4 10
> 6 3
> {code}
> The result is unsorted. The latter is the correct behavior because alias by
> column position is disabled hence the number {{2}} is a constant.
>
> Sort/Distribute/Cluster by are also affected.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)