Copilot commented on code in PR #13171:
URL: https://github.com/apache/gluten/pull/13171#discussion_r4602787718
##########
shims/spark42/src/main/scala/org/apache/gluten/sql/shims/spark42/Spark42Shims.scala:
##########
@@ -60,6 +60,21 @@ class Spark42Shims extends SparkShims {
override def isKeyGroupedPartitioning(partitioning: Partitioning): Boolean =
partitioning.isInstanceOf[KeyedPartitioning]
+ override def getKeyGroupedShuffleInfo(
+ partitioning: Partitioning): Option[KeyGroupedShuffleInfo] = {
+ partitioning match {
+ case p: KeyedPartitioning =>
+ val grouped = p.toGrouped
+ val partitionValues = grouped.partitionKeys.map(_.row)
+ if (partitionValues.isEmpty) {
+ None
+ } else {
+ Some(KeyGroupedShuffleInfo(grouped, grouped.expressions,
partitionValues))
+ }
Review Comment:
`toGrouped` sorts even an already-grouped layout, so `[2, 1]` becomes `[1,
2]`, changing the reducer IDs that Spark's keyed exchange must preserve. If the
other join input retains the original order, matching keys reach different join
partitions and matches can be lost. Preserve the supplied layout; the suggested
fix conservatively retains vanilla shuffle for ungrouped layouts or layouts
whose key order would change.
--
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]