perf(writer): borrow statistics in MinMaxColAggregator::update instead of cloning - #3171
Open
anoopj wants to merge 1 commit into
Open
perf(writer): borrow statistics in MinMaxColAggregator::update instead of cloning#3171anoopj wants to merge 1 commit into
anoopj wants to merge 1 commit into
Conversation
…d of cloning ParquetWriter clones the parquet Statistics for every column of every row group when collecting min/max bounds, but update() only reads it. For byte-array columns (string, binary, fixed, decimal) the clone duplicates the min and max byte buffers on the heap; for numeric columns it's a cheap copy. Take &Statistics and drop the clone at the call site. Roughly 15 ns per column per row group for byte-array columns, near nothing for numeric. Behavior is unchanged; the cheap PrimitiveType clone stays because it releases the borrow of self before the &mut self updates.
anoopj
force-pushed
the
perf-minmax-stats-clone
branch
from
September 8, 2026 04:52
a53b855 to
c05dd71
Compare
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.
What changes are included in this PR?
ParquetWriter clones the parquet Statistics for every column of every row group when collecting min/max bounds, but update() only reads it. For byte-array columns (string, binary, fixed, decimal) the clone duplicates the min and max byte buffers on the heap; for numeric columns it's a cheap copy.
Take &Statistics and drop the clone at the call site. Roughly 15 ns per column per row group for byte-array columns, near nothing for numeric. Behavior is unchanged; the cheap PrimitiveType clone stays because it releases the borrow of self before the &mut self updates.
Are these changes tested?
Existing tests