Skip to content

Optimize Schema Row.Builder, Row.FieldValueBuilder, - #41536

Open
reuvenlax wants to merge 4 commits into
apache:masterfrom
reuvenlax:perf/schema-row-builder
Open

reuvenlax wants to merge 4 commits into
apache:masterfrom
reuvenlax:perf/schema-row-builder

Conversation

@reuvenlax

@reuvenlax reuvenlax commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

…FieldAccessDescriptorParser: add fast-path check and parser for simple identifier field names without invoking ANTLR lexer/parser.

  • Row / RowUtils: add direct array-backed flat field overrides and direct value capture fast path avoiding RowFieldMatcher / FieldAccessDescriptor tree allocations when no nested overrides are present; lazily size Builder backing lists.
  • Add unit tests in RowTest and FieldAccessDescriptorParserTest, plus JMH benchmarks in RowBuilderBenchmark.

Also merged in optimizations from #40791

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR introduces well-targeted performance optimizations for Row.Builder, Row.FieldValueBuilder, and FieldAccessDescriptorParser by avoiding ANTLR parser overhead on simple identifiers and bypassing RowFieldMatcher / FieldAccessDescriptor tree allocations for flat field captures and overrides. The implementation preserves existing semantics and includes solid unit tests and JMH benchmarks.

🔍 General Feedback

  • The fast paths in FieldAccessDescriptorParser.isSimpleIdentifier, Row.FieldValueBuilder, and RowUtils.captureRowValues cleanly mirror the validation, type-casting, and nullability behavior of RowFieldMatcher and CapturingRowCases while avoiding intermediate object allocations.
  • Consider also resolving FieldAccessDescriptor keys in FieldValueBuilder.withFieldAccessDescriptors (if not already resolved) or keeping in mind that addOverride expects resolved descriptors with non-null fieldIds.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions github-actions Bot added java core size/l L: 250-999 lines changed labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers (or comment /summarize-failures for a summary of the failing checks).

…access parsing

- FieldAccessDescriptorParser: add fast-path check and parser for simple identifier
  field names without invoking ANTLR lexer/parser.
- Row / RowUtils: add direct array-backed flat field overrides and direct value capture
  fast path avoiding RowFieldMatcher / FieldAccessDescriptor tree allocations when no
  nested overrides are present; lazily size Builder backing lists.
- Add unit tests in RowTest and FieldAccessDescriptorParserTest, plus JMH benchmarks
  in RowBuilderBenchmark.

missing files
@reuvenlax
reuvenlax force-pushed the perf/schema-row-builder branch from 4f85e77 to cbd2ad1 Compare November 25, 2026 02:39
@github-actions github-actions Bot added size/xl XL: >=1000 lines changed and removed size/l L: 250-999 lines changed labels Nov 25, 2026
@reuvenlax

Copy link
Copy Markdown
Contributor Author

R: @sjvanrossum

@sjvanrossum I had a pr with improvements to Row creation, that I realized overlapped with your pr/40791. I merged those components of 40791 into this PR, if you don't mind.

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@reuvenlax

Copy link
Copy Markdown
Contributor Author

Note: This doesn't affect BeamSQL or most of the schema aggregation transforms, as those transforms already avoid using the Row builder - instead using Row.withSchema().attachValues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core java size/xl XL: >=1000 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant