Skip to content

Signed-zero array test fixtures claim the literal case agrees with Spark when it does not #5702

Description

@andygrove

Describe the bug

The signed-zero fixtures in the array SQL tests carry comments that contradict the tests around them, and would mislead anyone deciding whether to re-enable them.

spark/src/test/resources/sql-tests/expressions/array/array_distinct.sql:139:

-- negative zero (literal). Spark's NormalizeFloatingNumbers rewrites -0.0 to 0.0 at
-- analysis time, so both Spark and Comet collapse it and agree here.
query ignore(https://issues.apache.org/jira/browse/SPARK-54918)
SELECT array_distinct(array(0.0, double('-0.0'), 1.0))

The comment says the two agree, but the query immediately below it is skipped precisely because they do not. NormalizeFloatingNumbers only rewrites grouping keys, join keys, window partition specs and Distinct; the optimized plan for a plain SELECT keeps the -0.0 literal intact.

The same "NormalizeFloatingNumbers only rewrites literals, not parquet columns" framing appears in array_except.sql:77, array_intersect.sql:162 and array_union.sql:149.

Steps to reproduce

Read the fixtures, or run SELECT array_distinct(array(0.0, double('-0.0'), 1.0)) and observe that the literal case diverges too.

Expected behavior

The comments describe what actually happens: the divergence is not limited to column-sourced values, and the literal case is skipped for the same reason.

Additional context

Depends on the behavior decision in the linked signed-zero issue; the comments should be corrected when the skips are resolved. Found while reviewing #5262.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions