Skip to content

test: add SQL file tests for RuntimeReplaceable functions accelerated by Comet#4562

Merged
andygrove merged 1 commit into
apache:mainfrom
andygrove:test-rr-wins-coverage
Jun 2, 2026
Merged

test: add SQL file tests for RuntimeReplaceable functions accelerated by Comet#4562
andygrove merged 1 commit into
apache:mainfrom
andygrove:test-rr-wins-coverage

Conversation

@andygrove
Copy link
Copy Markdown
Member

Which issue does this PR close?

N/A. This adds test coverage only. Surfaces #4560.

Rationale for this change

A sweep of RuntimeReplaceable Spark functions found several that Comet already accelerates (they lower to expressions Comet supports) but which had no test coverage guarding that behavior. These tests pin the acceleration so it cannot silently regress.

What changes are included in this PR?

Adds SQL file tests for functions confirmed to run natively in Comet:

  • conditional/nullif_zeroif.sql - nullifzero, zeroifnull (lower to if/coalesce). MinSparkVersion: 4.0.
  • misc/equal_null.sql - equal_null (lowers to <=>).
  • misc/uniform.sql - uniform with fixed-seed literal args (lowers to Rand-based arithmetic). MinSparkVersion: 4.0.
  • array/array_size.sql - array_size (lowers to size). The NULL-array case is ignored pending array_size returns -1 instead of NULL for NULL input #4560 (returns -1 instead of NULL).
  • array/try_element_at.sql - try_element_at for arrays (lowers to element_at); map input falls back (spark_answer_only).
  • string/to_binary.sql - to_binary(x, 'hex') (lowers to unhex); UTF-8/base64 formats fall back (spark_answer_only).
  • string/collation.sql - collation (folds to a literal). MinSparkVersion: 4.0.

How are these changes tested?

This PR is test-only. The files run under CometSqlFileTestSuite, executing each query through both Spark and Comet and comparing results; default query blocks additionally assert native (non-fallback) execution. Verified locally with ./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite" -Dtest=none.

Copy link
Copy Markdown
Contributor

@mbutrovich mbutrovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will never say no to more tests, thanks @andygrove!

@andygrove andygrove merged commit 6326c02 into apache:main Jun 2, 2026
50 checks passed
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.

2 participants