abhishekrb19 opened a new pull request, #19689: URL: https://github.com/apache/druid/pull/19689
This is a follow-up to https://github.com/apache/druid/pull/19571. This patch addresses this review comment https://github.com/apache/druid/pull/19571#discussion_r3399518855 by refactoring the logic into an interface so it's extensible and maintainable. No other functional change. **New abstractions (2 interfaces + 2 impls)** - `StreamingPartitionsSpec` — was a concrete class, now a polymorphic Jackson interface (@JsonTypeInfo with type property, defaultImpl = DimensionValueSetPartitionsSpec). Its only method is `createCollector()` for now. - `DimensionValueSetPartitionsSpec` (type: "dim_value_set") — the built-in impl holding the old fields (partitionDimensions, maxValuesPerDimension, validation, equals/hashCode/toString). createCollector() returns null when there are no dimensions (disabled by default), otherwise a `DimensionValueSetCollector`. - `StreamingShardSpecCollector` — new interface defining the per-task lifecycle required for stamping the shard specs: `collect(segmentId, row)` (run-loop, per row), `onSegmentsRestored(segmentIds) (startup, disables pruning for restart-spanned segments), annotate(segment) (publish-time stamping), onSegmentPublished(segmentId)`. - `DimensionValueSetCollector` — the concrete collector holding the state that used to live in the runner (observedPartitionDimValuesBySegment ConcurrentHashMap, restartSpannedSegments set) and all the value-recording, capping, sorting, null-handling, and stamping logic. This PR has: - [x] been self-reviewed. - [x] added documentation for new or modified features or behaviors. - [ ] a release note entry in the PR description. - [x] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links. - [x] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. - [x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met. - [x] been tested in a test Druid cluster. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
