Repository navigation
Commit ebd3ecb
Optimize PLAIN parquet string column to dictionary array (#10614)
# 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]>1 parent 432fe12 commit ebd3ecb
2 files changed
Lines changed: 342 additions & 60 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
| 151 | + | |
149 | 152 | | |
150 | 153 | | |
151 | 154 | | |
| |||
181 | 184 | | |
182 | 185 | | |
183 | 186 | | |
184 | | - | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
459 | 462 | | |
460 | 463 | | |
461 | 464 | | |
462 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
463 | 468 | | |
464 | 469 | | |
465 | 470 | | |
| |||
530 | 535 | | |
531 | 536 | | |
532 | 537 | | |
533 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
534 | 541 | | |
535 | 542 | | |
536 | 543 | | |
| |||
565 | 572 | | |
566 | 573 | | |
567 | 574 | | |
568 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
569 | 578 | | |
570 | 579 | | |
571 | 580 | | |
| |||
609 | 618 | | |
610 | 619 | | |
611 | 620 | | |
612 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
613 | 624 | | |
614 | 625 | | |
615 | 626 | | |
| |||
672 | 683 | | |
673 | 684 | | |
674 | 685 | | |
675 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
676 | 691 | | |
677 | 692 | | |
678 | 693 | | |
| |||
687 | 702 | | |
688 | 703 | | |
689 | 704 | | |
690 | | - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
691 | 710 | | |
692 | 711 | | |
693 | 712 | | |
| |||
0 commit comments