refactor: Make shard spec collector an interface for extensibility #19689
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 267 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.334
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #19689"
general
weight: 0.35
abhishekrb19
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 iscreateCollector()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 nodimensions (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: