feat: support lazy encoding for complex type#540
Draft
zhangxffff wants to merge 2 commits intobytedance:mainfrom
Draft
feat: support lazy encoding for complex type#540zhangxffff wants to merge 2 commits intobytedance:mainfrom
zhangxffff wants to merge 2 commits intobytedance:mainfrom
Conversation
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 problem does this PR solve?
Issue Number: related #80
Type of Change
Description
Adds LazyComplex encoding for complex (ROW/ARRAY/MAP) columns so they can flow through the engine — store, sort, spill, shuffle — without per-operator decode/re-encode round-trips. Complex payload columns dominate spill and shuffle on Spark workloads with array/map/struct fields; today every window/spill/shuffle them pays a serialise+deserialise per batch even if the complex typed data is payload column.
This PR introduces:
LazyComplexVectorthat store encoded complex vector, contains aFlatVector<StringView>so that it can easily reuse exist serde code forStringView.LAZY_COMPLEXin VectorEncoding.h, to indicate a Vector is LazyComplexVector.LazyComplexCodecused to do encode/decode for Complex Vector.CompactRowLazyCodec, useCompactRowformat to do encode and decode.RowContainer, complex data in paylod column would force encoding and actor likeStringViewinsideRowContainerFlatVector<StringView>to a newRowVectorduring writer, and then pass to serde, inSpillReader, we wrap theFlatVector<StringView>to LazyComplexVector, so that LazyComplex data in RowContainer can easily spilled.FlatVector<StringView>and pass to Shuffle Writer as StringView. In ShuffleReaderNode, the lazy encoded data would unbundles and passed into next operator with lazy encoding format.Performance Impact
No Impact: This change does not affect the critical path (e.g., build system, doc, error handling).
Positive Impact: I have run benchmarks.
lazy encoding delivers 1.7×–2.5× end-to-end speedup on chained-Window and 1.9×–2.2× on wide-payload Window. The baseline pays decode + re-encode at every operator boundary; the lazy path memcpies the same bytes through.
Release Note
Please describe the changes in this PR
Release Note:
Checklist (For Author)
Breaking Changes
No
Yes (Description: ...)
Click to view Breaking Changes