[Parquet] Implement num distinct values for parquet writer - #10654
Conversation
cda6e4a to
5111139
Compare
5111139 to
5676cca
Compare
48c40aa to
d1fa404
Compare
|
@etseidl could you please take a look at this when you get a chance |
|
Yes, sorry @Rich-T-kid, still catching up from some time off 😅 |
@etseidl no worries! sorry about the ping |
etseidl
left a comment
There was a problem hiding this comment.
Thanks @Rich-T-kid, I think this looks good.
Am I right in thinking this will only work for the arrow writer (i.e. the row-based API will not populate the distinct count)? If so, we might want to note that in the docs.
And feel free to ping me any time, it's no bother...I'm scatterbrained 😅 |
d1fa404 to
4db4725
Compare
4db4725 to
62d6619
Compare
|
|
I'll give this a day before merging to allow others to take a look if they wish. Thanks again! |
|
Hearing no objections, the PR is merged. Thanks @Rich-T-kid |
) # Which issue does this PR close? - Closes apache#8608. - Closes apache#10650 # Rationale for this change see apache#8608, apache#10650 & apache/datafusion#24114 # What changes are included in this PR? Adds `set_write_row_group_number_distinct_values` to WriterProperties, which when enabled causes the ArrowWriter to track the exact number of distinct non-null values per column across the full row group and write it into the column chunk statistics footer as `distinct_count`. Tracking is implemented by hashing each non-null value using XxHash64 into a per-column HashSet<u64> that persists across batch writes and is finalized in `close()`. **The flag defaults to false so there is no impact on existing writers.** # Are these changes tested? yes, see test. # Are there any user-facing changes? yes, users will not be able to write `distinct_count` meta data to parquet files.
) # Which issue does this PR close? - Closes apache#8608. - Closes apache#10650 # Rationale for this change see apache#8608, apache#10650 & apache/datafusion#24114 # What changes are included in this PR? Adds `set_write_row_group_number_distinct_values` to WriterProperties, which when enabled causes the ArrowWriter to track the exact number of distinct non-null values per column across the full row group and write it into the column chunk statistics footer as `distinct_count`. Tracking is implemented by hashing each non-null value using XxHash64 into a per-column HashSet<u64> that persists across batch writes and is finalized in `close()`. **The flag defaults to false so there is no impact on existing writers.** # Are these changes tested? yes, see test. # Are there any user-facing changes? yes, users will not be able to write `distinct_count` meta data to parquet files.
Which issue does this PR close?
Rationale for this change
see #8608, #10650 & apache/datafusion#24114
What changes are included in this PR?
Adds
set_write_row_group_number_distinct_valuesto WriterProperties, which when enabled causes the ArrowWriter to track the exact number of distinct non-null values per column across the full row group and write it into the column chunk statistics footer asdistinct_count. Tracking is implemented by hashing each non-null value using XxHash64 into a per-column HashSet that persists across batch writes and is finalized inclose(). The flag defaults to false so there is no impact on existing writers.Are these changes tested?
yes, see test.
Are there any user-facing changes?
yes, users will not be able to write
distinct_countmeta data to parquet files.