cloud-fan commented on code in PR #38950:
URL: https://github.com/apache/spark/pull/38950#discussion_r1054401498
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala:
##########
@@ -142,12 +145,78 @@ case class EnsureRequirements(
Some(finalCandidateSpecs.values.maxBy(_.numPartitions))
}
+ // Retrieve the non-collection spec from the input
+ def getRootSpec(spec: ShuffleSpec): ShuffleSpec = spec match {
+ case ShuffleSpecCollection(specs) => getRootSpec(specs.head)
+ case spec => spec
+ }
+
+ // Populate the common partition values down to the scan nodes
+ def populatePartitionValues(plan: SparkPlan, values: Seq[InternalRow]):
SparkPlan =
+ plan match {
+ case scan: BatchScanExec =>
+ scan.copy(commonPartitionValues = Some(values))
+ case node =>
+ node.mapChildren(child => populatePartitionValues(child, values))
+ }
+
// Check if 1) all children are of `KeyGroupedPartitioning` and 2) they
are all compatible
// with each other. If both are true, skip shuffle.
- val allCompatible = childrenIndexes.sliding(2).forall {
- case Seq(a, b) =>
- checkKeyGroupedSpec(specs(a)) && checkKeyGroupedSpec(specs(b)) &&
- specs(a).isCompatibleWith(specs(b))
+ val allCompatible = childrenIndexes.length == 2 && {
Review Comment:
We should update the comments above as we only handle 2 children case now.
--
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]