Skip to content

perf(writer): borrow statistics in MinMaxColAggregator::update instead of cloning - #3171

Open
anoopj wants to merge 1 commit into
apache:mainfrom
anoopj:perf-minmax-stats-clone
Open

perf(writer): borrow statistics in MinMaxColAggregator::update instead of cloning#3171
anoopj wants to merge 1 commit into
apache:mainfrom
anoopj:perf-minmax-stats-clone

Conversation

@anoopj

@anoopj anoopj commented Sep 8, 2026

Copy link
Copy Markdown
Member

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

…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
anoopj force-pushed the perf-minmax-stats-clone branch from a53b855 to c05dd71 Compare September 8, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant