Skip to content

parquet plain dict bench - #10591

Merged
Jefffrey merged 2 commits into
apache:mainfrom
Rich-T-kid:rich-T-kid/parquet-Plain-dict-bench
Aug 11, 2026
Merged

Jefffrey merged 2 commits into
apache:mainfrom
Rich-T-kid:rich-T-kid/parquet-Plain-dict-bench

Conversation

@Rich-T-kid

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

see #10590

What changes are included in this PR?

introduces benchmarks for reading string values into dictionary arrays

Are these changes tested?

n/a

Are there any user-facing changes?

no

@github-actions github-actions Bot added the parquet Changes to the parquet crate label Aug 7, 2026
@Rich-T-kid Rich-T-kid changed the title Rich t kid/parquet plain dict bench parquet plain dict bench Aug 7, 2026
@Rich-T-kid
Rich-T-kid force-pushed the rich-T-kid/parquet-Plain-dict-bench branch from 906a25b to f4ee01b Compare August 7, 2026 21:55

@Jefffrey Jefffrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something i noticed was the other benches in this file seem to be at the page iterator or array reader level, whilst this new one is pretty much at the top level with the record batch reader api

is this something to be concerned about, or the behaviour we're trying to benchmark here can only be done via the top level api?

@Rich-T-kid

Copy link
Copy Markdown
Contributor Author

something i noticed was the other benches in this file seem to be at the page iterator or array reader level, whilst this new one is pretty much at the top level with the record batch reader api

is this something to be concerned about, or the behaviour we're trying to benchmark here can only be done via the top level api?

@Jefffrey The existing benchmarks measure the time to decode an already dictionary-encoded Parquet page into an Arrow dictionary array. This PR's benchmarks measure converting a plain-encoded (non-dictionary) string column into a dictionary array.

I used the top-level API here because it's the less verbose, and mirrors how I'd expect DataFusion to actually use it. That said, it's likely possible to do something similar with the finer-grained APIs. should I update the PR?

@Jefffrey Jefffrey added the development-process Internal changes; PRs with this label are excluded from changelog label Aug 11, 2026

@Jefffrey Jefffrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fine, thanks

@Jefffrey
Jefffrey merged commit fc16607 into apache:main Aug 11, 2026
18 checks passed
@Rich-T-kid
Rich-T-kid deleted the rich-T-kid/parquet-Plain-dict-bench branch August 11, 2026 10:01
MassivePizza pushed a commit to massive-com/arrow-rs that referenced this pull request Aug 19, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- works towards apache#10590
- works towards apache/datafusion#24111

# Rationale for this change
 see apache#10590
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?
introduces benchmarks for reading string values into dictionary arrays
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
n/a
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
no
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
Jefffrey added a commit that referenced this pull request Aug 22, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  #10590
- builds on top of #10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  #10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Aug 26, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  apache#10590
- builds on top of apache#10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  apache#10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Aug 28, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  apache#10590
- builds on top of apache#10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  apache#10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 2, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  apache#10590
- builds on top of apache#10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  apache#10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 18, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  apache#10590
- builds on top of apache#10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  apache#10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 21, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  apache#10590
- builds on top of apache#10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  apache#10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 25, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes  apache#10590
- builds on top of apache#10591
- works towards apache/datafusion#24111

# Rationale for this change

- see  apache#10590


<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

Optimizes plain-encoded string/binary columns read into Dictionary Arrow
arrays by eliminating the intermediate StringArray materialization.
Previously, all values were decoded into a flat array first, then
iterated again to build the dictionary. Now, hashes are computed upfront
in a single batch pass and used to deduplicate values directly into the
dictionary output buffers, reducing the work to a single pass over the
data. The hash scratch buffer is also reused across batches, so
allocation overhead amortizes as batch sizes grow.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
yes existing test cover this functionality. nothing logically has
changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
~~yes, `DictionaryBuffer::into_array()` now takes in scratch vector.
this is a breaking change~~

EDIT: no breaking changes, `DictionaryBuffer` isn't part of public API

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Internal changes; PRs with this label are excluded from changelog parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants