Skip to content

[SPARK-57756][SQL][TESTS] Add buildSQLFunctionConf ANSI-invariant tests#57042

Open
daniel-lunin-db wants to merge 1 commit into
apache:masterfrom
daniel-lunin-db:SPARK-57756-tests
Open

[SPARK-57756][SQL][TESTS] Add buildSQLFunctionConf ANSI-invariant tests#57042
daniel-lunin-db wants to merge 1 commit into
apache:masterfrom
daniel-lunin-db:SPARK-57756-tests

Conversation

@daniel-lunin-db

Copy link
Copy Markdown
Contributor

Add unit tests for Analyzer.buildSQLFunctionConf covering ANSI handling: a persisted ANSI value makes the alwaysSetAnsiValue flag a no-op, and the flag only takes effect when ANSI is not persisted (under ASSUME_ANSI_FALSE_IF_NOT_PERSISTED).

What changes were proposed in this pull request?

Add two unit tests in AnalysisSuite for Analyzer.buildSQLFunctionConf, the helper
that constructs the throwaway SQLConf used to resolve a SQL UDF body. The tests pin
the interaction between the alwaysSetAnsiValue parameter and a SQL UDF's persisted
ANSI config:

  • When spark.sql.ansi.enabled is persisted in the function's stored configs, the
    persisted value wins and alwaysSetAnsiValue is a no-op (checked with session
    overrides both on and off).
  • When ANSI is not persisted, alwaysSetAnsiValue=true seeds it to false (via
    ASSUME_ANSI_FALSE_IF_NOT_PERSISTED) while alwaysSetAnsiValue=false leaves it
    unset.

Why are the changes needed?

buildSQLFunctionConf was extracted in SPARK-57756 (#56895) but only had coverage
through the existing end-to-end SQL UDF resolution tests. These add direct unit
coverage for the ANSI-seeding branch, which is the subtle part of the helper.

Does this PR introduce any user-facing change?

No. Tests only.

How was this patch tested?

New tests in AnalysisSuite; CI runs them.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Anthropic Claude Opus)

Add unit tests for Analyzer.buildSQLFunctionConf covering ANSI handling: a
persisted ANSI value makes the alwaysSetAnsiValue flag a no-op, and the flag
only takes effect when ANSI is not persisted (under
ASSUME_ANSI_FALSE_IF_NOT_PERSISTED).
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