Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-28725: Sorting is performed when order by position is disabled when CBO is enabled #5623

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

kasakrisz
Copy link
Contributor

What changes were proposed in this pull request?

  • Do not create a HiveSortLimit operator when hive.orderby.position.alias is disabled and the Order by clause of the query has integer constants as keys. Also ignore the constants as keys when there are both column references and constant keys.
  • Do not create HiveSortExchange operator when both field collaction and distribution keys are all constants and hive.orderby.position.alias is disabled. Also ignore the constants as keys when there are both column references and constant keys.

Why are the changes needed?

To synchronize the Order/Sort/Distribute/Cluster by behaviors when hive.orderby.position.alias is disabled and CBO is enabled/disabled .

Does this PR introduce any user-facing change?

Yes, the results of queries with Order/Sort/Cluster by clauses may have different order.

Is the change a dependency upgrade?

No.

How was this patch tested?

mvn test -Dtest.output.overwrite -DskipSparkTests -Dtest=TestMiniLlapLocalCliDriver -Dqfile=cbo_distribute_sort_cluster_by_pos.q,cbo_rp_order_distribute_sort_cluster_by_cnst.q -pl itests/qtest -Pitests

Copy link
Contributor

@okumin okumin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kasakrisz kasakrisz merged commit dd5b05e into apache:master Feb 10, 2025
6 checks passed
@kasakrisz kasakrisz deleted the HIVE-28725-master-ob-pos branch February 10, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants