rich7420 commented on code in PR #6642:
URL: https://github.com/apache/datafusion-comet/pull/6642#discussion_r4253009784


##########
spark/src/test/scala/org/apache/spark/sql/CometTestBase.scala:
##########
@@ -497,14 +517,23 @@ abstract class CometTestBase
              |${org.apache.spark.sql.catalyst.util.stackTraceToString(e)}
            """.stripMargin)
       }
-    val preparedSpark = prepareCometAnswer(sparkAnswer, isSorted)
-    val preparedComet = prepareCometAnswer(cometAnswer, isSorted)
-    if (!QueryTest.compare(preparedSpark, preparedComet)) {
+    val ordering =
+      if (absTol.isDefined) toleranceOrdering else Ordering.by[Row, 
String](_.toString)
+    val preparedSpark = prepareCometAnswer(sparkAnswer, isSorted, ordering)
+    val preparedComet = prepareCometAnswer(cometAnswer, isSorted, ordering)
+    val matches = absTol match {
+      case Some(tol) =>
+        preparedSpark.length == preparedComet.length &&
+        preparedSpark.zip(preparedComet).forall { case (s, c) => rowsMatch(s, 
c, tol) }

Review Comment:
   Single-column maps also fail, confirmed with an extracted-helper probe on 
Scala 2.12/2.13:
   
   ```scala
   val spark = Seq(
     Row(ListMap("a" -> 1, "b" -> 2)),
     Row(ListMap("b" -> 1, "a" -> 2)))
   val comet = Seq(
     Row(ListMap("b" -> 2, "a" -> 1)),
     Row(ListMap("a" -> 2, "b" -> 1)))
   ```
   
   The original pairs match, but `toString` sorting swaps only Comet’s rows. 
Could we add this regression and match unordered rows one-to-one, preserving 
duplicates and allowing reassignment? A greedy first-match fallback can also 
miss valid pairings.



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