[SPARK-47430][SQL] Support GROUP BY for MapType#45549
Closed
stevomitric wants to merge 49 commits into
Closed
Conversation
…sSuite.scala Co-authored-by: Maxim Gekk <max.gekk@gmail.com>
…sSuite.scala Co-authored-by: Maxim Gekk <max.gekk@gmail.com>
Co-authored-by: Ruifeng Zheng <ruifengz@foxmail.com>
…essions/codegen/CodeGenerator.scala Co-authored-by: Wenchen Fan <cloud0fan@gmail.com>
cloud-fan
reviewed
Mar 25, 2024
cloud-fan
reviewed
Mar 25, 2024
| | ArrayData $keyArrayA = a.keyArray(); | ||
| | ArrayData $valueArrayA = a.valueArray(); | ||
| | ArrayData $keyArrayB = b.keyArray(); | ||
| | ArrayData $valueArrayB = b.valueArray(); |
Contributor
There was a problem hiding this comment.
do the above 4 variables need to use freshName? They are just local variables in this method.
cloud-fan
reviewed
Mar 25, 2024
| | ArrayData $valueArrayA = a.valueArray(); | ||
| | ArrayData $keyArrayB = b.keyArray(); | ||
| | ArrayData $valueArrayB = b.valueArray(); | ||
| | int $minLength = (lengthA > lengthB) ? lengthB : lengthA; |
cloud-fan
reviewed
Mar 25, 2024
| // This batch must be executed after the `RewriteSubquery` batch, which creates joins. | ||
| Batch("NormalizeFloatingNumbers", Once, NormalizeFloatingNumbers) :+ | ||
| Batch("NormalizeFloatingNumbers", Once, | ||
| InsertMapSortInGroupingExpressions, |
Contributor
There was a problem hiding this comment.
can we create a new batch for this rule?
cloud-fan
reviewed
Mar 25, 2024
|
|
||
| test("SPARK-46536 Support GROUP BY CalendarIntervalType") { | ||
| val numRows = 50 | ||
| private def assertAggregateOnDataframe(dfSeq: Seq[DataFrame], |
Contributor
There was a problem hiding this comment.
I'd rather test one DataFrame at a time, and the caller calls assertAggregateOnDataframe multiple times.
…essions/codegen/CodeGenerator.scala Co-authored-by: Wenchen Fan <cloud0fan@gmail.com>
cloud-fan
approved these changes
Mar 26, 2024
Contributor
Contributor
Author
stefankandic
approved these changes
Mar 27, 2024
Contributor
|
thanks, merging to master! |
cloud-fan
pushed a commit
that referenced
this pull request
Mar 27, 2024
### What changes were proposed in this pull request? Added normalization of map keys when they are put in `ArrayBasedMapBuilder`. ### Why are the changes needed? As map keys need to be unique, we need to add normalization on floating point numbers and prevent the following case when building a map: `Map(0.0, -0.0)`. This further unblocks GROUP BY statement for Map Types as per [this discussion](#45549 (comment)). ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? New UTs in `ArrayBasedMapBuilderSuite` ### Was this patch authored or co-authored using generative AI tooling? No Closes #45721 from stevomitric/stevomitric/fix-map-dup. Authored-by: Stevo Mitric <stevo.mitric@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changes were proposed in this pull request?
Changes proposed in this PR include:
MapSortexpression proposed in this PRWhy are the changes needed?
Adding new functionality to GROUP BY map types
Does this PR introduce any user-facing change?
Yes, ability to use
GROUP BY MapTypeHow was this patch tested?
With new UTs
Was this patch authored or co-authored using generative AI tooling?
No