Skip to content

chore(audit): audit any and expand tests#4436

Open
andygrove wants to merge 1 commit into
apache:mainfrom
andygrove:autonomous-audit/any
Open

chore(audit): audit any and expand tests#4436
andygrove wants to merge 1 commit into
apache:mainfrom
andygrove:autonomous-audit/any

Conversation

@andygrove
Copy link
Copy Markdown
Member

Which issue does this PR close?

N/A. Autonomous audit pass.

Rationale for this change

Audit of the any expression against Spark 3.4.3, 3.5.8, and 4.0.1.

any is registered in Spark's FunctionRegistry as a SQL alias of BoolOr, which extends RuntimeReplaceableAggregate with replacement = Max(child). The Catalyst analyzer rewrites any(x) (and the siblings some(x) and bool_or(x)) to max(x) before Comet sees the plan, so the expression is served by CometMax on a BooleanType column. boolAggregates.scala is byte-identical across the three audited Spark versions, so no shim is required.

The only finding was a test-coverage gap: the existing test bool_and/bool_or in CometAggregateSuite covers a single dataset of four rows with no NULLs, no empty group, no group-by, and no any/some alias.

What changes are included in this PR?

  • Audit sub-bullets under any in docs/source/contributor-guide/spark_expressions_support.md
  • New SQL-file test spark/src/test/resources/sql-tests/expressions/aggregate/any.sql covering column, literal, NULL, empty, all-NULL, group-by, and HAVING inputs for any, some, and bool_or

How are these changes tested?

./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite any" -Dtest=none -Dscalastyle.skip=true

Passes locally (1 test, 0 failures).

Scaffolded by the audit-comet-expression-autonomous skill.

Document that `any` is a SQL alias for `BoolOr`, which Catalyst rewrites
to `Max(child)` before Comet sees the plan, and add a SQL-file test
covering column, literal, NULL, empty, all-NULL, group-by, and HAVING
inputs for `any`, `some`, and `bool_or`. Behaviour is identical across
Spark 3.4.3, 3.5.8, and 4.0.1.

Scaffolded by the audit-comet-expression-autonomous skill.
@andygrove andygrove marked this pull request as ready for review May 27, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant