-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[thrift-remodel] Decoding of page indexes #8160
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
[thrift-remodel] Decoding of page indexes #8160
Conversation
to our own metadata structs. This reduces the amount of non-macro generated code.
|
Quick comparison of the old and new decoders: |
|
I will say that the page indexes are pretty darn expensive to parse, and the file used for the benchmark ( @alamb, not sure how radical you want to go here 😅 |
What drives the need to convert to array of structs? Is that the representation of the ColumnIndex in Rust or is it something about how the thrift is encoded? Copying of the min/max statistics for byte arrays takes the majority of that time (note that the test file does not contain the level histograms...those would be very costly as well if present). We could look into rethinking how we represent the column index. Perhaps saving the bytes read and presenting slices rather than copies will work (at least as far as the histograms in the column index...we may be stuck with min/max value copying). As you say, perhaps we could keep around a Maybe we could also contemplate some way to defer decoding/copying the structures out until they were requested
I have no pre-concieved ideas. I have personally always found the ColumnIndex representation in Rust ( |
Yes...parquet-rs takes the existing
I'll try playing around with that and see if it helps. Also, I think this came up before, but only materializing the column index for columns being filtered on rather than for the entire schema would certainly help. Selectively writing them would be useful as well. |
What we could do is create a new structure that is faster to decode, and then transform to the Index enum variant if requested (aka keep backwards compatibility logic for a while) 🤔 |
Yes, absolutely. Another really useful thing would be not decoding the page index / column index unless it is needed -- for example if we can prune the entire row group just with the row group statistics, we shouldn't even have to bother to decode the page index for that 🤔 |
| } | ||
| }; | ||
|
|
||
| // turn Option<Vec<i64>> into Vec<Option<i64>> |
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.
😢
| thrift_struct!( | ||
| pub(crate) struct ColumnIndex<'a> { | ||
| 1: required list<bool> null_pages | ||
| 2: required list<'a><binary> min_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.
This is so sad -- the structure actually starts out column oriented and then we pivot it to rows (just to have to pivot it back to columns to use in DataFusion)
| /// Only defined for BYTE_ARRAY columns. | ||
| pub unencoded_byte_array_data_bytes: Option<Vec<i64>>, | ||
| /// Vector of [`PageLocation`] objects, one per page in the chunk. | ||
| 1: required list<PageLocation> page_locations |
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 will admit these macros are quite neat and are growing on me
|
Time to merge this one. Next steps include further speed up of the offset index decoding, and creating a new column index avatar that avoids the costly conversion to an array of structs. |
Which issue does this PR close?
Note: this targets a feature branch, not main
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.
Rationale for this change
Speed
What changes are included in this PR?
Still a work in progress, but begins the process of converting page index parsing to the new thrift decoder.
Are these changes tested?
This PR actually uses the new decoder when parsing the page indexes using the existing machinery. As such all tests involving the page indexes should apply to this code.
Are there any user-facing changes?
Yes