sam-1112 commented on code in PR #5393:
URL: https://github.com/apache/datafusion-comet/pull/5393#discussion_r3813064693
##########
spark/src/test/resources/sql-tests/expressions/array/shuffle.sql:
##########
@@ -124,7 +124,7 @@ statement
INSERT INTO test_shuffle_double VALUES
(array(1.1, 2.2, 3.3, 4.4, 5.5)),
(NULL),
- (array(CAST('NaN' AS DOUBLE), CAST('Infinity' AS DOUBLE), CAST('-Infinity'
AS DOUBLE), 0.0, -0.0))
+ (array(CAST('NaN' AS DOUBLE), CAST('Infinity' AS DOUBLE), CAST('-Infinity'
AS DOUBLE), 0.0, double('-0.0')))
Review Comment:
Thanks, that was a real flake. Spark's stable sort keeps the shuffled order
of +0.0 and -0.0, while the SQL test comparator distinguishes the bits, so
`sort_array(shuffle(arr))` is not unique once the fixture actually contains
both signs.
I switched the unseeded double projection to
`sort_array(transform(shuffle(arr), x -> cast(x AS string)))` so the comparison
is a canonical multiset that still preserves both zero signs. The seeded
fixture is unchanged and still checks the exact permutation.
I also noted the `sort_array` pitfall next to the signed-zero guidance in
`sql-file-tests.md`.
--
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]