-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-48012][SQL] SPJ: Support Transfrom Expressions for One Side Shuffle #46255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -871,12 +871,30 @@ case class KeyGroupedShuffleSpec( | |
| if (results.forall(p => p.isEmpty)) None else Some(results) | ||
| } | ||
|
|
||
| override def canCreatePartitioning: Boolean = SQLConf.get.v2BucketingShuffleEnabled && | ||
| // Only support partition expressions are AttributeReference for now | ||
| partitioning.expressions.forall(_.isInstanceOf[AttributeReference]) | ||
| override def canCreatePartitioning: Boolean = { | ||
| // Allow one side shuffle for SPJ for now only if partially-clustered is not enabled | ||
| // and for join keys less than partition keys only if transforms are not enabled. | ||
| val checkExprType = if (SQLConf.get.v2BucketingAllowJoinKeysSubsetOfPartitionKeys) { | ||
|
||
| e: Expression => e.isInstanceOf[AttributeReference] | ||
| } else { | ||
| e: Expression => e.isInstanceOf[AttributeReference] || e.isInstanceOf[TransformExpression] | ||
| } | ||
| SQLConf.get.v2BucketingShuffleEnabled && | ||
| !SQLConf.get.v2BucketingPartiallyClusteredDistributionEnabled && | ||
| partitioning.expressions.forall(checkExprType) | ||
| } | ||
|
|
||
|
|
||
|
|
||
| override def createPartitioning(clustering: Seq[Expression]): Partitioning = { | ||
| KeyGroupedPartitioning(clustering, partitioning.numPartitions, partitioning.partitionValues) | ||
| val newExpressions: Seq[Expression] = clustering.zip(partitioning.expressions).map { | ||
| case (c, e: TransformExpression) => TransformExpression( | ||
| e.function, Seq(c), e.numBucketsOpt) | ||
| case (c, _) => c | ||
| } | ||
| KeyGroupedPartitioning(newExpressions, | ||
| partitioning.numPartitions, | ||
| partitioning.partitionValues) | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious what does this do? why it is normalized?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iirc, I hit a bug due to trying to compare different Seq types (more info in the pr description)