fix: preserve overflow behavior and exhaustively destructure expression proto hooks - #25034
Open
peterxcli wants to merge 1 commit into
Open
fix: preserve overflow behavior and exhaustively destructure expression proto hooks#25034peterxcli wants to merge 1 commit into
peterxcli wants to merge 1 commit into
Conversation
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25034 +/- ##
==========================================
+ Coverage 81.72% 81.74% +0.02%
==========================================
Files 1127 1127
Lines 416237 416271 +34
Branches 416237 416271 +34
==========================================
+ Hits 340156 340276 +120
+ Misses 56092 55967 -125
- Partials 19989 20028 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
peterxcli
marked this pull request as draft
September 7, 2026 22:53
peterxcli
marked this pull request as ready for review
September 8, 2026 01:25
3 tasks
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 #24614.
Rationale for this change
This PR fixes serialization losing the setting that makes arithmetic fail on overflow. For example, checked
Int32::MAX + 1raises an error before serialization but returnsInt32::MINafter decoding. Preserving this setting ensures that sending an expression through protobuf preserves its arithmetic behavior.What changes are included in this PR?
The protobuf message now stores
BinaryExpr::fail_on_overflow, and both supported decoding formats restore it. When the encoder combines nested expressions into a flat list of operands, it requires their operators and overflow settings to match. This preserves the behavior of expressions that mix checked and wrapping arithmetic. The generated Rust and JSON bindings include the new field.All six encoding and decoding hooks for
BinaryExpr,LikeExpr, andSqlSimilarToPatternexplicitly list every field without a rest pattern. Adding a field to an expression or its protobuf payload will cause a compile error until the corresponding hook handles it.The PR also changes the PostgreSQL SQLLogicTest decimal formatter to borrow its argument, resolving an existing Clippy error that blocked the required checks before committing.
What is the testing strategy for this PR?
The new tests serialize and decode nested additions, then check their evaluated results for all four combinations of checked and wrapping arithmetic. The regression test failed before the fix because an expression that should raise an overflow error returned
Int32(-2147483648). Additional tests cover older messages that omit the new field and verify that JSON preserves the overflow setting.All 17 focused expression tests passed. The extended workspace run passed 11,260 Rust tests, with 8 ignored, and completed all 511 SQLLogicTest files. Both conversion tests passed with the PostgreSQL feature enabled. Formatting, Clippy with all targets and features, and the complete
./dev/rust_lint.shsuite also passed.Are there any user-facing changes?
Expressions configured to fail on arithmetic overflow now raise the expected error after serialization and decoding, including nested expressions with different overflow settings.