reuvenlax opened a new pull request, #41813:
URL: https://github.com/apache/beam/pull/41813
Eliminates per-element wrapper, Builder, and collection allocations in
WindowedValues and FullWindowedValueCoder:
- **WindowedValues / WindowedValue**:
- Adds `singleWindowOrNull(WindowedValue)` using a primary-super
`SimpleWindowedValue` / `Builder` check to avoid JDK-8180450
`_secondary_super_cache` contention.
- Adds `builder(template, value)` and `ofWithCurrentContext(...)`
overloads, tracking `singleWindow` directly inside `Builder` without allocating
`Collections.singleton`.
- Normalizes OpenTelemetry `Context.root()` to `null` (documented on
`WindowedValue#getOpenTelemetryContext`) to avoid carrying/attaching empty
trace contexts on untraced pipelines.
- Marks concrete subclasses `final` and optimizes `of()`, `withValue()`,
and single-window `explodeWindows()`.
- **IterableLikeCoder / FullWindowedValueCoder**:
- Adds `@Internal` single-element and size-header helpers
(`encodeSingleElement`, `registerSingleElementByteSize`, `readSizeHeader`,
`decodeAfterSizeHeader`) so `FullWindowedValueCoder` avoids singleton-list
allocations on single-window encode/decode/byte-size observation, reuses the
cached `windowsCoder` on multi-window decode, and checks the plain
`paneInfo.isElementMetadata()` bit before the volatile `isMetadataSupported()`
load.
- Adds unit tests in `WindowedValueTest` and `CollectionCoderTest`.
*(Replaces fork-based #41803 to use native GitHub stacked PRs.)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]