Repository navigation
refactor(parquet): simplify guarded row-group byte-limit arithmetic - #11269
Merged
Merged
Conversation
Use the existing nonzero buffered-row guard to calculate average row bytes directly. Divide the remaining byte budget by that average with `checked_div`, replacing the separate zero-average filter and redundant fallback value. Preserve the existing split and flush behavior, including skipping the estimate-based split when average row bytes round down to zero. Keep the byte-budget calculation an estimate rather than a hard bound on serialized row-group size. Signed-off-by: Hippolyte Barraud <[email protected]>
Rich-T-kid
approved these changes
Sep 28, 2026
Rich-T-kid
left a comment
Contributor
There was a problem hiding this comment.
net positive in my opinion.
👍
etseidl
approved these changes
Sep 28, 2026
etseidl
left a comment
Contributor
There was a problem hiding this comment.
Thanks @HippoBaro. Took me awhile...I should have read the PR description more closely 😅
Comment on lines
+404
to
+405
| let avg_row_bytes = current_bytes / buffered_rows; | ||
| if let Some(rows_that_fit) = (max_bytes - current_bytes).checked_div(avg_row_bytes) |
Contributor
There was a problem hiding this comment.
This looks right. buffered_rows is always > 0, so we enter the branch only if avg_row_bytes > 0 due to the filter. Now we instead rely on checked_div for the avg_row_bytes > 0 condition.
Contributor
|
Thanks for the review @Rich-T-kid. |
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?
Rationale for this change
The row-group byte-limit calculation already runs under a guard that ensures the buffered row count is nonzero. Using checked division for that first calculation repeats the guard, while a separate zero-average filter and fallback value make the remaining-budget calculation more complicated than necessary.
Simplify the arithmetic while preserving the existing split and flush decisions.
What changes are included in this PR?
checked_div.Are these changes tested?
All tests passing.
Are there any user-facing changes?
No.