refactor: simplify dynamic state for Avro record projection#9419
Open
mzabaluev wants to merge 2 commits intoapache:mainfrom
Open
refactor: simplify dynamic state for Avro record projection#9419mzabaluev wants to merge 2 commits intoapache:mainfrom
mzabaluev wants to merge 2 commits intoapache:mainfrom
Conversation
Instead of parallel sparse arrays that need to be zipped for record projection, have a vector of enums that can either give a writer-to-reader mapping or a skipper.
6981044 to
9e6de69
Compare
jecsand838
approved these changes
Feb 17, 2026
Contributor
jecsand838
left a comment
There was a problem hiding this comment.
@mzabaluev LGTM! Love the cleanup and these performance improvements.
Thank you so much for getting this up!
@alamb If possible this would be another good one to get in before release! 🤞
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.
Rationale for this change
The inner loop in
Projector::project_recordgives the optimizer somewhat complicated dynamic data to branch through.The sparse arrays in
Projectorare redundantly coded:Nonein the index positions ofwriter_to_readermust matchSomeinskip_decodersand vice versa.What changes are included in this PR?
Refactor record projection state with a single array of directive-like enums corresponding to each writer schema field.
Are these changes tested?
Added a benchmark for record projection (the benchmark code is partially shared with #9397).
Somewhat counterintuitively for me, it does not show improvement on a more complex case with a mix of projected fields, but does improve the simpler one-field projection cases.
Passes the existing tests.