-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-48012][SQL] SPJ: Support Transfrom Expressions for One Side Shuffle #46255
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to understand the reason behind this. Also, it might be better to add some logging here if it is easy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. iirc, I hit a pretty hard bug when trying to enable the feature with v2BucketingAllowJoinKeysSubsetOfPartitionKeys (more in the pr description). As we may need to rethink the logic of v2BucketingAllowJoinKeysSubsetOfPartitionKeys to fix, I was going to disable for now, and try to fix in a subsequent PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked at it, maybe i will do logging in another pr. There's no table name so not sure if its valuable to log the decision? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, sounds good. |
||
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?
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)