aokolnychyi commented on a change in pull request #3992:
URL: https://github.com/apache/iceberg/pull/3992#discussion_r794071636



##########
File path: 
spark/v3.2/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/MergeRowsExec.scala
##########
@@ -46,6 +48,15 @@ case class MergeRowsExec(
     output: Seq[Attribute],
     child: SparkPlan) extends UnaryExecNode {
 
+  override def requiredChildOrdering: Seq[Seq[SortOrder]] = {
+    if (performCardinalityCheck) {
+      // request a local sort by the row ID attrs to co-locate matches for the 
same target row
+      Seq(rowIdAttrs.map(attr => SortOrder(attr, Ascending)))

Review comment:
       We used to rely on a separate query and an accumulator, which was a 
source of issues too. I think we will have more options when we move this to 
Spark (e.g. we will be able to insert a rule at the query prep stage when we 
already know the physical plan).




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