fix(proto): correctly serialize FilterExec empty projection#21873
Closed
Adez017 wants to merge 11 commits intoapache:mainfrom
Closed
fix(proto): correctly serialize FilterExec empty projection#21873Adez017 wants to merge 11 commits intoapache:mainfrom
FilterExec empty projection#21873Adez017 wants to merge 11 commits intoapache:mainfrom
Conversation
askalt
reviewed
Apr 27, 2026
| ) | ||
| // After deserializing, check if it equals the full range | ||
| let num_fields = schema.fields().len(); | ||
| let full_projection: Vec<usize> = (0..num_fields).collect(); |
Contributor
There was a problem hiding this comment.
Currently the code requires a vector allocation to check if the other vector is 0,1,2,3.., but we can do it without allocations using a loop (sample code):
let mut projection = Vec::with_capacity();
let mut is_full_projection =
filter.projection.len() == input.schema().fields.len();
for (i, idx) in filter.projection.iter().enumerate() {
let idx = idx as usize;
is_full_projection &= idx == i;
projection.push(idx);
}
let projection = if is_full_projection {
None
} else {
Some(projection)
};
Contributor
Author
|
Hi @askalt , i'll be opening a fresh new PR as i am gettign some build error with this branch |
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.
Which issue does this PR close?
FilterExecempty projection is changed to full projection after serde #21871Rationale for this change
FilterExecsupports two semantically different projection states:However, both cases were being serialized identically as an empty vector in the proto representation. During deserialization, an empty vector was always mapped back to None, meaning an empty projection would silently become a full projection after a serde round-trip.
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
No