You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 714956b
Browse filesBrowse the repository at this point in the historyBrowse files
fix: preserve overflow behavior and exhaustively destructure expression proto hooks (#25034)
## 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 + 1` raises an error
before serialization but returns `Int32::MIN` after 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`, and
`SqlSimilarToPattern` explicitly 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.sh` suite 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.
---------
Co-authored-by: Andrew Lamb <[email protected]>
0 commit comments