-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: Add KLL Datasketch and Hive ColumnStatisticsObj as standard blo… #8202
base: main
Are you sure you want to change the base?
Conversation
core/src/main/java/org/apache/iceberg/puffin/StandardBlobTypes.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/puffin/StandardBlobTypes.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/puffin/StandardBlobTypes.java
Outdated
Show resolved
Hide resolved
Thanks a lot for the review! :) |
@findepi I have addressed the review comments. Can you please have a look at the PR when you are free? |
core/src/main/java/org/apache/iceberg/puffin/StandardBlobTypes.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/puffin/StandardBlobTypes.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/puffin/StandardBlobTypes.java
Outdated
Show resolved
Hide resolved
Thanks for the review :) |
@nastra , I have updated the PR and moved the iceberg-docs(apache/iceberg-docs#269) changes to the main repo. Please have a look when you are free. Thanks again for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @findepi could you review this as well please?
Any progress update here? It would be great to get the blessing from the Iceberg community for these as supported puffin blob types |
@findepi @danielcweeks could one of you PTAL this? Don't want this effort to get lost. |
@simhadri-g update I'm following up on this today. |
thanks @bitsondatadev ! |
Any update? hope we can continue to push this review forward. |
format/puffin-spec.md
Outdated
@@ -126,6 +126,23 @@ The blob metadata for this blob may include following properties: | |||
|
|||
- `ndv`: estimate of number of distinct values, derived from the sketch. | |||
|
|||
#### `hive-column-statistics-obj` blob type | |||
|
|||
A serialized form of Hive ColumnStatsObject. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is what's referenced here the Thrift ColumnStatisticsObj
in the Hive IDL? https://github.com/apache/hive/blob/ffb1165f59defa66b31b4fd9cb6367b71050071b/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift#L583
If so, I'd recommend correcting the name, and linking to the Thrift IDL, and explicitly calling out that this is Thrift-serialized.
I'm also wondering if we need to think about versioning. If this is based on the Thrift IDL, I am not sure if those are intended to be persisted. At the very least, I am concerned if Hive decides to introduce a backwards-incompatible field to this struct, some engines begin to serialize with this newly introduced backwards incompatible field, and other engines begin to attempt to deserialize it with an older IDL, then it will break in the Iceberg library.
Please let me know if I'm misunderstanding anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
In hive , we writes the statistics to HMS in addition to puffin files.
So the Thrift ColumnStatisticsObj is used to write the statistics to HMS.
hive-column-statistics-obj referred here is a serialized using the org.apache.commons.lang3.SerializationUtils and stored into puffin file.
Hi everyone, |
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
hi @simhadri-g, would you mind reopening this PR? |
Hi Denys! |
hey @simhadri-g, if you'd like to pursue this I would recommend opening a new one, but split into 2 parts: Hive ColumnStatistics and KLL Datasketch |
thanks @nastra! It would really help if we could get this in. |
thanks @nastra and @deniskuzZ ! I will resolve the merge conflicts and update this PR. :) |
…b types to puffin file
…o the main iceberg/format
Co-authored-by: Eduard Tudenhoefner <[email protected]>
bec46a7
to
a4fdf6c
Compare
@findepi Could you please have a look as well? |
format/puffin-spec.md
Outdated
@@ -181,6 +181,23 @@ for Puffin v1. | |||
[roaring-bitmap-portable-serialization]: https://github.com/RoaringBitmap/RoaringFormatSpec?tab=readme-ov-file#extension-for-64-bit-implementations | |||
[roaring-bitmap-general-layout]: https://github.com/RoaringBitmap/RoaringFormatSpec?tab=readme-ov-file#general-layout | |||
|
|||
#### `hive-column-statistics-obj` blob type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just FYI that adding changes to the Spec now requires a VOTE on the Dev mailing list in order to increase visibility for spec changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I start [DISCUSS] thread first or go ahead with [VOTE]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also start with a DISCUSS thread first in order to have a short discussion on the introduced changes
format/puffin-spec.md
Outdated
|
||
The ColumnStatsObject supports Histograms, NDV, Min and Max values, Number of nulls, Number of trues, column name, type. | ||
A full list of supported statistics is listed in the table here: | ||
[ColumnStatistics](https://cwiki.apache.org/confluence/display/Hive/StatsDev#StatsDev-ColumnStatistics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see much value in adding this.
NDV sketches are already supported using Theta sketches so this would duplicate the purpose of an existing sketch. Is there sufficient value to justify the difference? This doesn't provide enough context to tell.
In addition, the Iceberg manifest format already covers value count, lower bounds, upper bounds, number of nulls, and number of NaNs. The partition statistics files provide a way to aggregate those beyond the file level, and we use snapshot summaries for table-level stats. I'm not sure what value this would provide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @rdblue,
thanks for checking this PR!
The partition statistics files provide a way to aggregate those beyond the file level
Does iceberg provide build-in support to get an aggregated Column stats? I mean, is there some library/service that generates partition files with an aggregated column stats?
AFAIK we only do this for basic stats : #11216
If yes, could you please point me to the code where is that done? I had an impression that from colstats only NDV is calculated and stored in partition files.
How about:
- bitvectors - used to improve stats estimations for IN operator
- histogram - histogram statistics, which are particularly useful for skewed data and range predicates (KLL data sketches)
- numTrue/numFalse
- avgColLen
Wouldn't it make sense to store in a single puffin file an aggregated partition column stats object per table snapshot with all the values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @rdblue,
I'm sorry, it seems we had pretty limited knowledge in that area and now I think we finally get your point.
I've drafted a small doc with the proposal and our intent: https://docs.google.com/document/d/11Rp-irqb4L4Qpdxr6l83bA4IRsfw3AAyR8wokNe1r80/edit?usp=sharing
Could you please take a quick look and suggest if that is a valid proposal.
Thank you!
format/puffin-spec.md
Outdated
Apache-Datasketches-KLL-sketch is an implementation of a very compact quantiles | ||
sketch with lazy compaction scheme and nearly optimal accuracy per bit. | ||
|
||
Histograms are derived from this sketch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't much to go on. How is the sketch calculated? Does this support a single column or multiple columns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per column: KllSketchUDF(columnName, columnStatsType)
more details: https://issues.apache.org/jira/browse/HIVE-26221
I would agree with @rdblue's comment that there's a lot of stats overlap with what exists elsewhere and I'm not convinced this serialized format is standardized well enough to be used easily outside of the Hive/Impala projects. Could we identify the specific stats that we feel are valuable and focus on those independently of what is captured elsewhere? |
Hi @danielcweeks, |
…b types to puffin file
Issue:
#8198
Hi Everyone,
Hive now supports writing column statistics to puffin files.
The statistics calculated by Hive include histograms, NDV (Number of Distinct Values), Min and Max values, the number of nulls, the number of true values, column name, and column type. You can find the full list of supported stats here: Link to GitHub.
We are updating the description of this PR to request incorporating the KLL datasketch for histograms.
As a result, we are looking to add KLL datasketch as standard blob types for the puffin file. Link to GitHub
Any feedback would be greatly appreciated.
Thanks!