Skip to content

HIVE-26368: DISTINCT keyword from Count UDF is removed from query pla…#6582

Open
soumyakanti3578 wants to merge 1 commit into
apache:masterfrom
soumyakanti3578:HIVE-26368
Open

HIVE-26368: DISTINCT keyword from Count UDF is removed from query pla…#6582
soumyakanti3578 wants to merge 1 commit into
apache:masterfrom
soumyakanti3578:HIVE-26368

Conversation

@soumyakanti3578

Copy link
Copy Markdown
Contributor

…n when CBO is enabled

What changes were proposed in this pull request?

Add a check in HiveExpandDistinctAggregatesRule and return early if there are multiple columns in a COUNT DISTINCT

Why are the changes needed?

Otherwise the rule removes DISTINCT from the COUNT, and when the COUNT is over multiple columns, GenericUDAFCount expects a DISTINCT (which is also semantically right).

Does this PR introduce any user-facing change?

No

How was this patch tested?

mvn test -pl itests/qtest -Pitests -Dtest=TestMiniLlapLocalCliDriver -Dtest.output.overwrite=true -Dqfile="count_distinct_multi_col.q"

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@soumyakanti3578 soumyakanti3578 marked this pull request as ready for review July 8, 2026 19:08
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.

2 participants