Uh oh!
There was an error while loading. Please reload this page.
PARQUET-2261: Implement SizeStatistics - #1177
Conversation
wgtmac
commented
Oct 19, 2023
I have drafted the POC to read/write SizeStatistics. The feature implementation should be complete and associated tests will be added progressively. Please take a look when you have time. Thanks! @emkornfield cc @mapleFU |
etseidl
commented
Oct 19, 2023
Thanks @wgtmac, this looks great! I'm not sure if this is in scope for this PR, but it would be nice if the CLI was aware of the changes. Specifically, it would be great if the |
wgtmac
commented
Oct 20, 2023
Thanks for the suggestion! Yes, it definitely should be done. @etseidl |
emkornfield
commented
Oct 20, 2023
@wgtmac took a scan through and this generally seems like what I expected. Thank you for doing it. Agree unit tests are needed. |
Uh oh!
There was an error while loading. Please reload this page.
cc0d75d to
0acf99fCompare26ced88 to
4ff9d3dCompare339d397 to
ed3a89eComparewgtmac
commented
Nov 23, 2023
I have just rebased on the latest master branch and fixed all CI falures. As this PR gets too large, I will add print cli command and rewriter support for |
wgtmac
commented
Nov 23, 2023
cc @ConeyLiu as I have modified mergeColumnStatistics method which you've just refactored. |
ConeyLiu
commented
Nov 23, 2023
Thank @wgtmac for your notification. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
emkornfield
commented
Dec 6, 2023
Took another pass through, I'm less familiar with Parquet MR but overall looks ok to me (with the exception of confirming if the one place I found we should be changing length to 0) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eb7a1a5 to
aa69b35Compareshangxinli
commented
Feb 18, 2024
LGTM @ConeyLiu@etseidl@emkornfield Do you still have pending comments? |
etseidl
commented
Feb 19, 2024
Looks good to me too. I'd still like to see the CLI changed at some point to print the new statistics, but if no one else has cycles to work on that, I could try cleaning up what I have locally. |
wgtmac
commented
Feb 19, 2024
@etseidl I have filed https://issues.apache.org/jira/browse/PARQUET-2433 and https://issues.apache.org/jira/browse/PARQUET-2434 as follow-up work items. Will work on them once this PR gets merged. |
ConeyLiu
left a comment
There was a problem hiding this comment.
+1 thanks for the great work.
emkornfield
commented
Feb 19, 2024
I think all of my suggestions have been addressed. Thanks @wgtmac ! |
wgtmac
commented
Feb 23, 2024
@gszadovszky It would be good if you can take a look if possible. |
gszadovszky
left a comment
There was a problem hiding this comment.
I have some comments but LGTM overall.
This change is about writing these new statistics. Are there any benefits in actually using them at reading? Do we plan to implement?
Side note: This is yet another statistics that we gather during writing data. We already have min/max statistics, null counts, bloom filter, and now some additional ones. I think, we should implement a centralized builder that we call once for each value/dl/rl and can generate the statistics we need. We need to implement the gathering part as optimal as it can be. One check less can significantly decrease write performance.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public void add(int repetitionLevel, int definitionLevel, Binary value) { | ||
| add(repetitionLevel, definitionLevel); | ||
| if (type.getPrimitiveTypeName() == PrimitiveType.PrimitiveTypeName.BINARY && value != null) { | ||
| unencodedByteArrayDataBytes = Math.addExact(unencodedByteArrayDataBytes, value.length()); |
There was a problem hiding this comment.
I don't think, we shall fear of an overflow while adding an int to a long.
There was a problem hiding this comment.
I tend to keep this check just in case.
There was a problem hiding this comment.
In most cases, it is good to have checks like this one. But it can significantly hit performance when used in places called regularly. This method is invoked for every values. We shall be as effective as possible.
There was a problem hiding this comment.
Make sense. I have removed the overflow check.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
wgtmac
commented
Feb 24, 2024
Thanks for the feedback! I've addressed all the comments and added a new internal |
| void write(int value, int repetitionLevel, int definitionLevel) { | ||
| statistics.updateStats(value); | ||
| sizeStatisticsBuilder.add(repetitionLevel, definitionLevel); | ||
| if (bloomFilter != null) { |
There was a problem hiding this comment.
What do you think about using a no-op BloomFilter implementation instead of a null-check? I am not sure if would perform better, though.
There was a problem hiding this comment.
Fixed. Could you please review it again?
### Rationale for this change Parquet format 2.10.0 has introduced SizeStatistics. parquet-mr has also implemented this: apache/parquet-java#1177. Now it is time for parquet-cpp to pick the ball. ### What changes are included in this PR? Implement reading and writing size statistics for parquet-cpp. ### Are these changes tested? Yes, a bunch of test cases have been added. ### Are there any user-facing changes? Yes, now parquet users are able to read and write size statistics. * GitHub Issue: #40592 Authored-by: Gang Wu <ustcwg@gmail.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
### Rationale for this change Parquet format 2.10.0 has introduced SizeStatistics. parquet-mr has also implemented this: apache/parquet-java#1177. Now it is time for parquet-cpp to pick the ball. ### What changes are included in this PR? Implement reading and writing size statistics for parquet-cpp. ### Are these changes tested? Yes, a bunch of test cases have been added. ### Are there any user-facing changes? Yes, now parquet users are able to read and write size statistics. * GitHub Issue: #40592 Authored-by: Gang Wu <ustcwg@gmail.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
Make sure you have checked all steps below.
Jira
Tests
Commits
Documentation