Uh oh!
There was an error while loading. Please reload this page.
[SPARK-42132][SQL] Deduplicate attributes in groupByKey.cogroup - #39673
[SPARK-42132][SQL] Deduplicate attributes in groupByKey.cogroup#39673EnricoMi wants to merge 9 commits into
Conversation
Ideally, |
AmplabJenkins
commented
Jan 22, 2023
Can one of the admins verify this patch? |
4e5901e to
16721f1Compareshardulm94
commented
Feb 28, 2023
cc: @cloud-fan@viirya@gengliangwang For help with reviews. |
mridulm
commented
Apr 26, 2023
+CC @HyukjinKwon, @cloud-fan |
There was a problem hiding this comment.
it's a bit weird to do dedup here. Can we update the DeduplicateRelations rule to handle CoGroup specially?
There was a problem hiding this comment.
I don't really see how DeduplicateRelations can be modified to not rewrite all attributes of CoGroup.
In DeduplicateRelations.apply method renewDuplicatedRelations is called, which calls rewriteAttrs(attrMap) on the CoGroup, which rewrites all attributes.
If you are suggesting to add case cogroup @ CoGroup(...) => to
then this won't work because all attributes of
CoGroup have been rewritten at this point.I'd appreciate some pointers or sketch of a solution.
16721f1 to
cc5773cCompareEnricoMi
commented
Oct 9, 2023
Fixed in #41554. |
What changes were proposed in this pull request?
This deduplicate attributes that exist on both sides of a
CoGroupby aliasing the occurrence on the right side.Why are the changes needed?
Usually, DeduplicateRelations rule does exactly this. But the generic
QueryPlan.rewriteAttrsreplaces all occurrences of the duplicate reference with the new reference, butCoGroupuses the old reference for left and right group attributes, value attributes, and group order. Only the occurrences in the right attributes must be replaced.Further, the right deserialization expression is not touched at all.
The following DataFrame cannot be evaluated:
The query plan:
Evaluating this plan fails with:
Does this PR introduce any user-facing change?
This fixes correctness.
How was this patch tested?
Unit test in
DataFrameSuite.