This is an automated email from the ASF dual-hosted git repository.
felixybw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 95b9dc380f [WIP] investigate GlutenQueryTest (#11081)
95b9dc380f is described below
commit 95b9dc380fc3996e801ccdbb1db3c3f165031c75
Author: Jiaan Geng <[email protected]>
AuthorDate: Wed Nov 19 17:24:37 2025 +0800
[WIP] investigate GlutenQueryTest (#11081)
This PR proposes to refactor the sameRows for GlutenQueryTest.
Currently, the implementation of sameRows seems a little unclear and this
PR wants simplify it.
---
.../org/apache/spark/sql/GlutenQueryTest.scala | 30 ++++++++++------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git
a/gluten-substrait/src/test/scala/org/apache/spark/sql/GlutenQueryTest.scala
b/gluten-substrait/src/test/scala/org/apache/spark/sql/GlutenQueryTest.scala
index 4d93e3d7ae..ff08f0171b 100644
--- a/gluten-substrait/src/test/scala/org/apache/spark/sql/GlutenQueryTest.scala
+++ b/gluten-substrait/src/test/scala/org/apache/spark/sql/GlutenQueryTest.scala
@@ -691,24 +691,22 @@ object GlutenQueryTest extends Assertions {
return None
}
- // if answer is not fully sorted, we should sort the answer first, then
compare them
- val sortedExpected = expected.sortBy(_.toString())
- val sortedActual = actual.sortBy(_.toString())
- if (!compare(sortedExpected, sortedActual)) {
- return Some(genError(sortedExpected, sortedActual))
- }
-
- // if answer is absolutely not sorted, the compare above is enough
- if (sortedColIdxes.isEmpty) {
- return None
+ if (sortedColIdxes.nonEmpty) {
+ // if answer is partially sorted, we should compare the sorted part
+ val expectedPart = expected.map(row => sortedColIdxes.map(row.get))
+ val actualPart = actual.map(row => sortedColIdxes.map(row.get))
+ if (!compare(expectedPart, actualPart)) {
+ return Some(genError(expected, actual))
+ }
+ } else {
+ // if answer is not fully sorted, we should sort the answer first, then
compare them
+ val sortedExpected = expected.sortBy(_.toString())
+ val sortedActual = actual.sortBy(_.toString())
+ if (!compare(sortedExpected, sortedActual)) {
+ return Some(genError(sortedExpected, sortedActual))
+ }
}
- // if answer is partially sorted, we should compare the sorted part
- val expectedPart = expected.map(row => sortedColIdxes.map(row.get))
- val actualPart = actual.map(row => sortedColIdxes.map(row.get))
- if (!compare(expectedPart, actualPart)) {
- return Some(genError(expected, actual))
- }
None
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]