Skip to content

Optimize Beam schemas - #41699

Open
reuvenlax wants to merge 20 commits into
apache:masterfrom
reuvenlax:perf/optimize-beam-schemas
Open

reuvenlax wants to merge 20 commits into
apache:masterfrom
reuvenlax:perf/optimize-beam-schemas

Conversation

@reuvenlax

Copy link
Copy Markdown
Contributor

No description provided.

…eldAccessDescriptor, RowMessages, and SchemaUtils
…byte-size observer, and specialized LogicalType coders
…ompact/fewKeys), CombineFns, and decimal byte-size
…orFactory, POJOUtils, AutoValueUtils, ConvertHelpers, ReflectUtils
…cuit, 2-way fast path, and fused broadcast joins
… YAML Java providers (Explode, Logging, ErrorHandling, JavaRowUdf, StringCompiler, MapToFields, Filter)
…ithGetters cache, and POJOUtils creator chunking
Fixes all 31 Round 1 findings (C1-C6, P1-P12, T1-T13) across correctness, bytecode safety, JVM performance, and test coverage:

- RowWireCodec: guard readExact(len==0), readNullMask/readNullBytes(0/<0), overflow-safe buf.length checks in packWideNullHeader*, single-pass 8-fields/byte packWideNullHeaderFromArray/List with outlined huge fallback, INT_LE extractChunkNullMask32/putChunkNullMask32/patchWideNullHeaderPrefix, ScratchPool MAX_DEPTH=8, and GC-safe RefScratchPool.
- DirectSchemaCoderGenerator: 0-alloc wide nullable JavaBean encode (compact refSlotByPos + RefScratchPool), 0-alloc bit-packed ByteSizeChunkImpl return ((chunkBytes<<6)|localNullTag + 1L<<57 overflow guard), single-buffer in-place ChunkedEncodeImpl null header, needsScratchForDecode skip + OOM-safe non-overlapping try/catch scopes, direct mask==0 chunk decode dispatch, omit empty chunk methods, and shared ASM helpers.
- RowCoderGenerator: unlock getOrGenerateFieldCodec from cacheLock with weighted Metaspace budget (MAX_GENERATED_FIELD_CODEC_WEIGHT=512), omit dead decNullC*/encRowC* families gated by supports*(), direct mask==0 chunk decode dispatch, needsDecodeScratch skip, O(1) cheapCheckPositions, 1-byte hot local slots, and transient chunkedFieldCodec.
- Schema: restore O(1) Long.bitCount slot lookup for index < 64, lazy highContainerCacheSlots for index >= 64, consistent IndexOutOfBoundsException check, and remove dead isCacheableContainerField.
- POJOUtils: restore generation-time zero-arg constructor validation in ChunkedSetFieldCreateInstruction and flatten SetFieldChunkInstruction Compound tree.
- DirectSchemaCoderTest: add exhaustive wide-schema coverage across cutoffs (64/65/1024/1025/4200), reversed encodingPositions, non-nullable/static POJOs & JavaBeans, rich types, evolution, error branches, and POJOUtils/Schema/RowWireCodec edge cases.

Verified with Spotless, Checkstyle, 628/628 core schema/coder tests, benchmarks, and unanimous 3/3 Round 2 reviewer approvals.
@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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant