test: Add ANSI mode SQL test files for expressions that throw on invalid input#3377
Open
andygrove wants to merge 1 commit intoapache:mainfrom
Open
test: Add ANSI mode SQL test files for expressions that throw on invalid input#3377andygrove wants to merge 1 commit intoapache:mainfrom
andygrove wants to merge 1 commit intoapache:mainfrom
Conversation
This PR adds: 1. Framework support for `query expect_error(<pattern>)` mode in the SQL test framework, which verifies both Spark and Comet throw exceptions containing the given pattern. 2. New ANSI mode test files: - `math/abs_ansi.sql` - Tests abs overflow on INT_MIN, LONG_MIN, etc. - `math/arithmetic_ansi.sql` - Tests arithmetic overflow and divide-by-zero - `array/get_array_item_ansi.sql` - Tests out-of-bounds array access (ignored pending apache#3375) - `array/element_at_ansi.sql` - Tests out-of-bounds element_at (ignored pending apache#3375) 3. Documentation for the new `expect_error` query mode. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3377 +/- ##
============================================
+ Coverage 56.12% 60.02% +3.89%
- Complexity 976 1464 +488
============================================
Files 119 175 +56
Lines 11743 16179 +4436
Branches 2251 2686 +435
============================================
+ Hits 6591 9711 +3120
- Misses 4012 5114 +1102
- Partials 1140 1354 +214 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
comphead
reviewed
Feb 5, 2026
| assert( | ||
| sparkError.isDefined, | ||
| s"Expected Spark to throw an error matching '$pattern' but query succeeded") | ||
| assert( |
Contributor
There was a problem hiding this comment.
So if cometError returned it also means sparkError returned? 🤔
Member
Author
There was a problem hiding this comment.
If the query is tagged with expect_error then we expect both Spark and Comet to return an error
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 #.
Rationale for this change
What changes are included in this PR?
This PR adds:
Framework support for
query expect_error(<pattern>)mode in the SQL test framework, which verifies both Spark and Comet throw exceptions containing the given pattern.New ANSI mode test files:
math/abs_ansi.sql- Tests abs overflow on INT_MIN, LONG_MIN, etc.math/arithmetic_ansi.sql- Tests arithmetic overflow and divide-by-zeroarray/get_array_item_ansi.sql- Tests out-of-bounds array access (ignored pending ANSI mode array access error messages don't match Spark format #3375)array/element_at_ansi.sql- Tests out-of-bounds element_at (ignored pending ANSI mode array access error messages don't match Spark format #3375)Documentation for the new
expect_errorquery mode.How are these changes tested?