stevomitric opened a new pull request, #46974:
URL: https://github.com/apache/spark/pull/46974

   ### What changes were proposed in this pull request?
   In this PR, rule `InsertMapSortInGroupingExpressions` was modified to add an 
alias for `map_sort(col)` . Grouping and aggregate expressions are then 
modified to use this alias.
   
   ### Why are the changes needed?
   Currently, trying to reference a map column that is being grouped by, causes 
reference errors because we are only replacing the grouping expression `m` with 
`map_sort(m)`. The following query fails:
   
   ```sql
   SELECT m FROM table GROUP BY m
   ```
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   New Tests in this PR, and existing tests regarding grouping of map types.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


-- 
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