[SPARK-48619] Fix reference error when grouping by MapType
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:
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
@n-young-db @cloud-fan can you please take a look at this.
Approved but please address comments! Just didn't want to block over the weekend.
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!