Skip to content

Cherry pick #113047 to 26.3: Keep the Map bucket_indexes stream in sync when rows are skipped - #113717

Merged
robot-ch-test-poll3 merged 3 commits into
backport/26.3/113047from
cherrypick/26.3/113047
Aug 7, 2026
Merged

robot-ch-test-poll3 merged 3 commits into
backport/26.3/113047from
cherrypick/26.3/113047

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

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-pick locally.
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:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

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
@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels Aug 6, 2026
…ypick/26.3/113047

# Conflicts:
#	src/DataTypes/DataTypeMap.cpp
#	src/DataTypes/Serializations/SerializationMap.cpp
#	src/DataTypes/Serializations/SerializationMapKeysOrValues.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants