cloud-fan commented on code in PR #38950:
URL: https://github.com/apache/spark/pull/38950#discussion_r1043335767
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/physical/partitioning.scala:
##########
@@ -694,28 +694,32 @@ case class KeyGroupedShuffleSpec(
// transform functions.
// 4. the partition values, if present on both sides, are following the
same order.
case otherSpec @ KeyGroupedShuffleSpec(otherPartitioning,
otherDistribution) =>
- val expressions = partitioning.expressions
- val otherExpressions = otherPartitioning.expressions
-
distribution.clustering.length == otherDistribution.clustering.length &&
- numPartitions == other.numPartitions &&
- expressions.length == otherExpressions.length && {
- val otherKeyPositions = otherSpec.keyPositions
- keyPositions.zip(otherKeyPositions).forall { case (left, right) =>
- left.intersect(right).nonEmpty
- }
- } && expressions.zip(otherExpressions).forall {
- case (l, r) => isExpressionCompatible(l, r)
- } &&
partitioning.partitionValuesOpt.zip(otherPartitioning.partitionValuesOpt).forall
{
+ numPartitions == other.numPartitions &&
isExpressionsCompatible(otherSpec) &&
+
partitioning.partitionValuesOpt.zip(otherPartitioning.partitionValuesOpt).forall
{
case (left, right) => left.zip(right).forall { case (l, r) =>
ordering.compare(l, r) == 0
}
- }
+ }
case ShuffleSpecCollection(specs) =>
specs.exists(isCompatibleWith)
case _ => false
}
+ def isExpressionsCompatible(other: KeyGroupedShuffleSpec): Boolean = {
Review Comment:
Since this is `KeyGroupedShuffleSpec`, how about `areKeysCompatible`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]