feat: Add ChangelogRowVector for RowKind propagation#70
Open
ggjh-159 wants to merge 5 commits into
Open
Conversation
8 tasks
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.
What changes are proposed in this pull request?
This introduces a new data structure
ChangelogRowVectorundervelox/experimental/stateful/, intended as the standard data carrier for changelog-aware streaming between stateful operators.It pairs an existing
RowVector(schema columns) with a per-rowRowKindvector (TINYINT, ordinal values aligned with Flink'sorg.apache.flink.types.RowKind: 0=INSERT, 1=UPDATE_BEFORE, 2=UPDATE_AFTER, 3=DELETE).The new type lives next to
StreamRecordand does not modify any existing operator, vector, or plan node. This PR only adds the data-carrier primitive + C++ unit tests. Wiring it into the operator chain is tracked as a follow-up).Public API
Key design decisions
appendOnlyis inferred, not a parameter. True whenrowKindis null or aConstant(INSERT)vector. This keeps the constructor surface minimal and avoids two callers disagreeing on the flag.RowVectorschema. It travels alongside the data so existing velox operators (FilterProject, HashAggregation, etc.) remain byte-for-byte unchanged.$row_kindis constrained to the trailing column. LetsfromMergedRowVectorsplit without scanning names, and letstoMergedRowVectorround-trip exactly.Why are the changes needed?
Flink
RowDatacarries a per-rowRowKindthat distinguishes+I/-U/+U/-D. When changelog streams cross into veloxthrough the stateful operator chain, this signal is currently dropped at the input boundary, which silently corrupts retract semantics (group aggregate, temporal join, sink output prefixes).
This PR is the foundation layer of a multi-PR effort to restore that signal end-to-end. Centralizing the
(value, rowKind, appendOnly)binding in a single primitive lets downstream operators compose with it instead of each call site re-deriving theappendOnlyflag.Related design + phased plan: support-rowkind-column-issue
Test
New C++ unit test
velox_stateful_changelog_row_vector_test