vladimirg-db opened a new pull request, #57629:
URL: https://github.com/apache/spark/pull/57629

   ### What changes were proposed in this pull request?
   
   Normalize map-typed arguments of distinct aggregate expressions with 
`MapSort`, reusing the same
   projected aliases used for grouping expressions. Add regression coverage for 
both the single- and
   multi-DISTINCT aggregation paths.
   
   This is a draft while the corresponding Apache Spark Jira is created.
   
   ### Why are the changes needed?
   
   Map equality is independent of entry order, but distinct aggregation 
currently compares the
   physical map representation. Equivalent maps with different insertion orders 
are therefore counted
   as different values.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `COUNT(DISTINCT map_column)` now treats maps containing the same 
entries in different orders as
   the same value. The regression query returns 2 instead of 3.
   
   ### How was this patch tested?
   
   Added single- and multi-DISTINCT cases to `DataFrameAggregateSuite` and ran:
   
   `build/sbt 'sql/testOnly *DataFrameAggregateSuite -- -z "count distinct map 
values"'`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to