Repository navigation
Cherry pick #132416 to 26.9: Declare raw-byte leaves of Arrow IPC columns with their decoded type - #132840
Merged
robot-ch-test-poll2 merged 6 commits intoNov 19, 2026
Conversation
A dotted header column such as `t.s IPv6` makes the native Arrow IPC reader decode the binary child `s` of the struct `t` as `IPv6`. When the parent `t` is requested too, with a type that does not describe `s` (for example `String`), the decoded `t` still declared the child as `String`, because its declared type comes from the Arrow schema. The raw-byte rewrite after decoding follows the parent target type only, so it did not reconcile the child, and the cast of `t` read the `IPv6` column as a `ColumnString`. `matchColumnNullability` already walks the declared type alongside the decoded column. Extend it to leaves: a `String` or `FixedString` leaf that was decoded as `IPv6` or a big integer is declared with that type. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ded type A dictionary-encoded `fixed_size_binary(16)` child is converted to `UUID` when a dotted header column such as `t.u UUID` requests it: `decodeDictionaryBatch` rewrites the dictionary values with `reinterpretRawByteColumns`. `rawByteLeafType` listed only the types that `reinterpretStringLeaf` produces, so `matchColumnNullability` kept declaring the leaf as `FixedString(16)`. When the parent `t` was requested too, with a type that does not describe `u` (for example `String`), the cast of `t` read the `UUID` column as a `FixedString` one: a failed `assert_cast` in debug builds, undefined behavior in release builds. Declare such a leaf as `UUID`, and throw a `LOGICAL_ERROR` for a `String` or `FixedString` leaf that holds a column of any other type, so a conversion this walk does not know becomes an exception instead of undefined behavior. Review: #132416 (comment) Related: #132416 Co-authored-by: Yakov Olkhovskiy <[email protected]>
The children of an Arrow union restart the dotted path, so the struct child `s` of a union child has the path `s`, and the lookup in the requested types found the unrelated header column `s`. Its type changed how the child decodes (raw bytes read as `IPv6`, or the null map of a struct kept for a `Tuple`), while `decodeUnion` declares its children from the Arrow schema, so the cast of the union read the column as another type: a failed `assert_cast` in debug builds, a segmentation fault in release builds. A dictionary of a field below a union got the same hint, from `collectDictionaryUses` and again in `decodeDictionaryValues`. Look up no requested type while decoding the children of a union, and the values of a dictionary used below one. Keep these dictionary positions apart from equally named positions outside the union (`FieldPosition::below_union`), so a dictionary that a field outside the union shares does not hand the union the decoding requested for that field. Review: #132416 (comment) Related: #132416 Co-authored-by: Yakov Olkhovskiy <[email protected]>
…d type The values of an Arrow dictionary are decoded once for each use: the position of a field encoding it, and the requested type hint the field resolves there. The uses were deduplicated and the decodings registered by position alone, but two fields at one position can resolve different hints: a field literally named `t.u` takes the type requested for `t.u`, while the child `u` of a struct `t` takes the type of `u` in a requested `t Tuple(...)`. When such fields shared a dictionary id, both read the decoding of whichever came first in the schema. For example, with ``t Tuple(u UUID), `t.u` String`` the field named `t.u` returned the 36-byte text of a `UUID` instead of its 16 bytes, and requesting it as `IPv6` threw. Key the uses and the registry by the position together with the hint, and look the decoding up with the use that `decodeField` and `decodeBatchColumn` resolve for the field. A use missing from the registry is now a `LOGICAL_ERROR` instead of a `std::out_of_range`. Review: #132416 (comment) Co-authored-by: Yakov Olkhovskiy <[email protected]>
…-consistency Declare raw-byte leaves of Arrow IPC columns with their decoded type
|
|
Resolve the conflicts of the cherry-pick of #132416 to 26.9. The fix applies in full; the differences from the original diff come only from master-only neighbours that 26.9 does not have: - `ArrowIPCBlockInputFormat.cpp`: 26.9 still checks that dictionary values are unique after registering them (master dropped the check in #125677). Keep the check and look the values up by the dictionary use, as the registry is now keyed by it. - `RecordBatchDecoder.cpp`: 26.9 has no `TypeKind::RunEndEncoded` case in `collectDictionaryUses` (run-end encoding, #126207, is master-only), so there is no call to pass `below_union` to there. The struct case keeps the 26.9 helpers `tupleElementHint` / `childPath` (master renamed them in #125674) and passes `below_union` as the original change does. - `RecordBatchDecoder.cpp`: include `base/scope_guard.h` for the two new `SCOPE_EXIT` uses. On master the include came with the big-endian reader (#126562); 26.9 does not include it, directly or transitively. - `RecordBatchDecoder.h`: no `[[nodiscard]]` on the changed declarations, as on the rest of the 26.9 file (master added them in #126158). Co-authored-by: yakov <[email protected]>
robot-ch-test-poll2
merged commit Nov 19, 2026
6cfcc9b
into
backport/26.9/132416
1 of 2 checks passed
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 #132416
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.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
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