[GLUTEN][VL] Fix redundant copies in Delta DV plan conversion#12389
Merged
Conversation
VeloxPlanConverter.cc (parseDeltaSplitInfo): - Fix double dynamic_pointer_cast: the original code called dynamic_pointer_cast<DeltaSplitInfo> twice (once in the ternary condition, once in the true branch). Use a single cast + null check. - Avoid unnecessary std::string copy from protobuf: the accessor serialized_deletion_vector() returns a const std::string& to the internal protobuf field, but 'auto' (by value) triggered a full string copy into a local variable. Changed to 'const auto&' to bind directly to the protobuf internal field, eliminating the intermediate copy. The shared_ptr<string> construction then copies once from the reference (unavoidable since it needs ownership). Assisted-by: GitHub Copilot:claude-opus-4.6
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves parseDeltaSplitInfo in the Velox backend plan conversion path by removing redundant work during Delta deletion vector (DV) split parsing, reducing unnecessary overhead in hot code.
Changes:
- Avoid repeated
std::dynamic_pointer_cast<DeltaSplitInfo>by performing a single cast and null-check. - Avoid an intermediate local
std::stringmaterialization from the protobuf DV payload by binding the protobuf field asconst auto&and copying directly into the owned payload buffer.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zhztheplayer
approved these changes
Jun 30, 2026
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 were proposed in this pull request?
Fix two minor inefficiencies in
VeloxPlanConverter.cc(parseDeltaSplitInfo):Double
dynamic_pointer_cast: the original code calleddynamic_pointer_cast<DeltaSplitInfo>twice (once in the ternary condition, once in the true branch). Changed to a single cast + null check.Unnecessary
std::stringcopy from protobuf: the accessorserialized_deletion_vector()returns aconst std::string&to the internal protobuf field, butauto(by value) triggered a full string copy into a local variable. Changed toconst auto&to bind directly to the protobuf internal field, eliminating the intermediate copy.How was this patch tested?
velox_delta_read_test): all passDeltaDeletionVectorScanInfoSuite: passVeloxDeltaSuite: passWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude claude-opus-4.6