wangyum commented on code in PR #58195:
URL: https://github.com/apache/spark/pull/58195#discussion_r4578866608


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowGroupLimitExec.scala:
##########
@@ -205,6 +206,19 @@ class GroupedLimitIterator(
 
   val grouping = UnsafeProjection.create(partitionSpec, output)
 
+  private val groupEqualityCheck: (UnsafeRow, UnsafeRow) => Boolean =

Review Comment:
   nit: This `isBinaryStable` / `InterpretedOrdering.forSchema` fallback looks 
very similar to the one in `WindowEvaluatorFactory.scala` 
(`WindowPartitionEvaluator.eval`, lines 67-75), added earlier for SPARK-47443:
   
   ```scala
   val groupEqualityCheck =
     if (partitionSpec.forall(e => UnsafeRowUtils.isBinaryStable(e.dataType))) {
       (key1: UnsafeRow, key2: UnsafeRow) => key1.equals(key2)
     } else {
       val types = partitionSpec.map(_.dataType)
       val ordering = InterpretedOrdering.forSchema(types)
       (key1: UnsafeRow, key2: UnsafeRow) => ordering.compare(key1, key2) == 0
     }
   ```
   
   Not a blocker, but would it make sense to factor this out into a small 
shared helper (e.g. `UnsafeRowUtils.rowEqualityChecker(types: Seq[DataType])`, 
alongside `isBinaryStable`)? It might make it a bit easier to keep the two call 
sites consistent going forward, and could be worth considering as a follow-up 
if you'd rather not scope it into this PR. Just a thought, feel free to 
disregard if you see it differently.



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