misc: Fix Projector stream offset mapping for multi-column projection#539
Open
xiaoxmeng wants to merge 1 commit intofacebookincubator:mainfrom
Open
misc: Fix Projector stream offset mapping for multi-column projection#539xiaoxmeng wants to merge 1 commit intofacebookincubator:mainfrom
xiaoxmeng wants to merge 1 commit intofacebookincubator:mainfrom
Conversation
Summary: CONTEXT: When projecting multiple top-level columns (e.g., int_traits_map and long_traits_map), the Projector crashes during deserialization because the projected schema's stream offsets don't match the actual data layout. The root cause: buildProjectedSchema assigned output offsets sequentially via depth-first traversal (all int_traits_map streams first, then long_traits_map). But project() copies input streams to output positions based on inputStreamIndices_ (sorted by input offset). When sibling subtrees' input offsets interleave numerically (e.g., long_traits_map nulls=2 falls between int_traits_map nulls=1 and its first child at offset 3), the depth-first traversal assigns wrong output offsets — causing the Deserializer to misinterpret stream data types and crash. WHAT: Replace sequential offset allocation in buildProjectedSchema with an offset map (input offset → output index) derived from sorted inputStreamIndices_. This ensures projected schema offsets exactly match the data layout produced by project(), regardless of how input stream offsets interleave across sibling subtrees. Differential Revision: D95328184
|
@xiaoxmeng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95328184. |
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.
Summary:
CONTEXT: When projecting multiple top-level columns (e.g., int_traits_map and
long_traits_map), the Projector crashes during deserialization because the
projected schema's stream offsets don't match the actual data layout.
The root cause: buildProjectedSchema assigned output offsets sequentially via
depth-first traversal (all int_traits_map streams first, then long_traits_map).
But project() copies input streams to output positions based on
inputStreamIndices_ (sorted by input offset). When sibling subtrees' input
offsets interleave numerically (e.g., long_traits_map nulls=2 falls between
int_traits_map nulls=1 and its first child at offset 3), the depth-first
traversal assigns wrong output offsets — causing the Deserializer to
misinterpret stream data types and crash.
WHAT: Replace sequential offset allocation in buildProjectedSchema with an
offset map (input offset → output index) derived from sorted
inputStreamIndices_. This ensures projected schema offsets exactly match the
data layout produced by project(), regardless of how input stream offsets
interleave across sibling subtrees.
Differential Revision: D95328184