minni31 commented on code in PR #13171:
URL: https://github.com/apache/gluten/pull/13171#discussion_r4603497705


##########
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:
   Addressed in this update. Spark 4.2 now accepts native key-grouped shuffle 
only for nonempty, already-grouped layouts whose key order is unchanged by 
`toGrouped`. Accepted metadata retains the original partitioning and key order; 
unsorted or ungrouped layouts fall back to Spark's vanilla shuffle.
   
   Added regressions for sorted layout preservation, `[2, 1]` fallback, and 
ungrouped/empty layouts. Scala formatting, license-header and whitespace checks 
passed. Compilation and Spark runtime tests have not been run locally.
   



-- 
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]

Reply via email to