Repository navigation
Cherry pick #113047 to 26.5: Keep the Map bucket_indexes stream in sync when rows are skipped - #113718
Merged
Conversation
The `with_buckets` `Map` serialization writes a flat `bucket_indexes` stream with one entry per key-value pair, and uses it on read to restore the original key order. `SerializationMap::deserializeBinaryBulkWithMultipleStreams` and `SerializationMapKeysOrValues::deserializeBinaryBulkWithMultipleStreams` forwarded `rows_offset` to the per-bucket streams but always read the index stream from its current position with `rows_offset` implicitly zero. The number of index entries that belong to the skipped rows is not `rows_offset` - it is the number of key-value pairs in those rows - so for a partial-granule read the index stream would desynchronize from the bucket streams: the kept rows would be reassembled from the bucket ids of earlier rows, and, when the skipped and kept rows have different per-bucket counts, the reconstruction could step past the selected bucket slice. Read the skipped rows together with the requested ones, reassemble the whole range in the original order and drop the prefix afterwards, so both streams advance by the same amount. Add a gtest that round-trips a bucketed `Map` and its `keys` subcolumn through in-memory substreams for every `rows_offset`; without the fix it reconstructs wrong rows and trips a huge allocation. No caller in this repository passes a non-zero `rows_offset` today, so this is a latent bug rather than a user-visible one. Follow-up to #109178
…ap-rows-offset Keep the Map `bucket_indexes` stream in sync when rows are skipped
…ypick/26.5/113047 # Conflicts: # src/DataTypes/DataTypeMap.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #113047
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job