fix: preserve total_byte_size in calculate_total_byte_size when num_r… - #24027
Open
bert-beyondloops wants to merge 1 commit into
Open
fix: preserve total_byte_size in calculate_total_byte_size when num_r…#24027bert-beyondloops wants to merge 1 commit into
bert-beyondloops wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24027 +/- ##
==========================================
- Coverage 80.85% 80.85% -0.01%
==========================================
Files 1101 1101
Lines 374933 374951 +18
Branches 374933 374951 +18
==========================================
+ Hits 303166 303177 +11
- Misses 53671 53675 +4
- Partials 18096 18099 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pepijnve
approved these changes
Aug 3, 2026
| match row_size { | ||
| None => { | ||
| match (row_size, &self.num_rows) { | ||
| (None, _) | (Some(_), Precision::Absent) => { |
Contributor
There was a problem hiding this comment.
This change makes sense to me since it avoids downgrading Exact total_byte_size to absent when num_rows is Absent.
Member
There was a problem hiding this comment.
Intuitively this makes sense to me too, hopefully we will soon be able to have a more data-driven approach thanks to #23975.
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
Statistics::calculate_total_byte_sizeis meant to derivetotal_byte_sizefromnum_rowsand the schema's fixed-width columns. When all columns have a primitive width butnum_rowsisPrecision::Absent, the old code computedself.num_rows.multiply(&Precision::Exact(size)), andPrecision::multiplyreturnsPrecision::Absentwhenever either operand isAbsent. This silently overwrote any previously knowntotal_byte_size(exact or inexact) withAbsent, even though the non-primitive-width branch already handled this situation correctly by downgrading the existing value to inexact instead of discarding it.What changes are included in this PR?
Statistics::calculate_total_byte_size, when the schema is all fixed-width but num_rows isPrecision::Absent,keep the existingtotal_byte_sizeand downgrade it to inexact viato_inexact(),instead of overwriting it withAbsent.calculate_total_byte_sizeto describe this behavior.test_calculate_total_byte_sizecovering: an all-primitive schema with known row count (exact size), an all-primitive schema with unknown row count (preserved but downgraded to inexact), and a non-primitive schema(always downgraded to inexact regardless of row count).
Are these changes tested?
Yes — added `stats::tests::test_calculate_total_byte_size, exercising all three branches of the updated match.
Are there any user-facing changes?
No public API changes. Statistics propagation is more accurate (previously known total_byte_size estimates are no longer dropped to Absent when num_rows is unknown), which may result in slightly better cost-based planning
decisions in some cases.