fix(proto): check plan integer conversions across usize boundaries - #24483
Open
buraksenn wants to merge 1 commit into
Open
fix(proto): check plan integer conversions across usize boundaries#24483buraksenn wants to merge 1 commit into
buraksenn wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24483 +/- ##
=========================================
Coverage 81.23% 81.24%
=========================================
Files 1111 1113 +2
Lines 390208 392929 +2721
Branches 390208 392929 +2721
=========================================
+ Hits 316990 319219 +2229
- Misses 54591 54917 +326
- Partials 18627 18793 +166 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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?
usizeon 32-bit targets #24170.Rationale for this change
Several logical and physical plan protobuf paths convert wire integers to
usizewith unchecked casts. On 32-bit targets, values aboveu32::MAXsilently truncate. For row limits, a fetch of1 << 32becomes0, causing a plan that should return rows to return an empty result.The reverse conversion can also truncate when a 64-bit
usizedoes not fit the protobuf field.What changes are included in this PR?
usize, with errors identifying the plan node and field.-1sentinel for limits without a fetch.FilterExecpayloads.usizestatistics as unknown rather than truncating them.The protobuf wire format is unchanged.
Follow-up work will make common protobuf option and constraint conversions fallible.
Are these changes tested?
Yes. Added unit and protobuf roundtrip coverage for checked conversions, architecture-dependent integer boundaries, oversized encode/decode values, limits without a fetch, malformed zero-column
Valuesnodes, and zero batch sizes.Are there any user-facing changes?
Out-of-range plan integers now return a clear planning error instead of silently truncating. Invalid zero batch sizes are rejected, and out-of-range statistics become unknown. There are no breaking public API or protobuf wire-format changes.