test: let Spark 4 test profiles use the Spark-default ANSI mode#4370
Merged
Conversation
CometTestBase pinned spark.sql.ansi.enabled to false, which meant the Spark 4.0/4.1/4.2 test profiles never exercised the ANSI behavior real Spark 4 users get out of the box. Stop setting the conf in the base; tests now run with each Spark version's own default (3.x off, 4.x on). Suites and individual tests that genuinely assume non-ANSI semantics opt out explicitly: - Suite-level overrides: CometFuzzMathSuite, CometCastSuite, and CometAggregateSuite (most tests cover silent overflow / wrap-around). - CometSqlFileTestSuite runner prepends ANSI=false to the conf list so the .sql fixture's own --Config line still wins for the _ansi.sql files that opt in to ANSI. - Per-test withSQLConf wraps for the long tail in CometExpressionSuite, CometArrayExpressionSuite, CometMathExpressionSuite, CometDateTimeUtilsSuite, CometExecSuite, and ParquetReadSuite.
mbutrovich
approved these changes
May 20, 2026
Contributor
mbutrovich
left a comment
There was a problem hiding this comment.
LGTM, do we need a plan to enhance the ANSI-specific test paths, or do we think those are well exercised by the existing tests that came in with ANSI-specific PRs?
Thanks @andygrove!
Member
Author
I think we're good. We have explicit ANSI opt-in testing for all supported expressions that have different behavior for ANSI mode. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #.
Builds on the idea behind #4368.
Rationale for this change
CometTestBasewas pinningspark.sql.ansi.enabledtofalse, so the Spark 4.0/4.1/4.2 test profiles never actually exercised the ANSI behavior real Spark 4 users get out of the box. Tests that pass against Comet today may regress in production because we never run them with the same defaults.What changes are included in this PR?
ANSI_ENABLEDinCometTestBase.sparkConf. Spark 3.x picks up its own default (off), Spark 4.x picks up its own default (on).sparkConfat the suite level to disable ANSI (tests that target ANSI behavior already opt in viawithSQLConf(ANSI_ENABLED -> "true")):CometFuzzMathSuiteCometCastSuiteCometAggregateSuiteCometSqlFileTestSuite: prependANSI_ENABLED -> "false"to the conf list passed intowithSQLConf. The_ansi.sqlfixtures that include--CONFIG: spark.sql.ansi.enabled=truestill win, because their values are applied later.withSQLConf(SQLConf.ANSI_ENABLED.key -> "false")wraps for the long tail inCometExpressionSuite,CometArrayExpressionSuite,CometMathExpressionSuite,CometDateTimeUtilsSuite,CometExecSuite, andParquetReadSuite.How are these changes tested?
The existing tests are the test. Ran the affected suites under
-Pspark-4.0locally (892 tests across 10 suites, 0 failures):CometFuzzMathSuiteCometCastSuiteCometAggregateSuiteCometExpressionSuiteCometArrayExpressionSuiteCometMathExpressionSuiteCometDateTimeUtilsSuiteCometExecSuiteCometSqlFileTestSuiteParquetReadV1SuiteCI will sweep Spark 4.0/4.1/4.2 across all the partitions.