EnricoMi commented on code in PR #35965:
URL: https://github.com/apache/spark/pull/35965#discussion_r864659237


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2ScanExecBase.scala:
##########
@@ -138,6 +138,15 @@ trait DataSourceV2ScanExecBase extends LeafExecNode {
     }
   }
 
+  override def outputOrdering: Seq[SortOrder] = scan match {
+    case s: SupportsReportOrdering if this.logicalLink.isDefined &&
+      // when groupedPartitions are applied (see `partitions` and 
`outputPartitioning`) and
+      // multiple partitions are grouped together, the order inside individual 
partitions gets lost
+      (partitions.length == 1 || groupedPartitions.forall(_.forall(_._2.length 
== 1))) =>

Review Comment:
   You are right, I mis-interpreted `if (partitions.length == 1) 
SinglePartition` in `def outputPartitioning`, but `partitions` already 
incorporates `groupedPartitions`. Fixing that.



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