refactor: Make shard spec collector an interface for extensibility#19689
refactor: Make shard spec collector an interface for extensibility#19689abhishekrb19 wants to merge 5 commits into
Conversation
|
Should this go in v38? |
| // Over-cap: omit this dim from the stamped filter map (still a DimensionValueSetShardSpec for | ||
| // class-uniformity; possibleInDomain treats an absent dim as unconstrained, so pruning is disabled | ||
| // for it on this segment). | ||
| if (maxValuesPerDimension != null && vals.size() > maxValuesPerDimension) { |
There was a problem hiding this comment.
future: I wonder if it's worth somehow making this exclusion condition dependent on the frequency of the column values? For example, keeping the best – those which have highest chance of reducing read amplification – pruning column values in the shard spec?
There was a problem hiding this comment.
I wonder if it's worth somehow making this exclusion condition dependent on the frequency of the column values?
Yes, frequency-based should be possible. I think it'd either require introducing a mode into this existing shard type or adding a new shard spec altogether (that resembles a bloom value set use case).
FrankChen021
left a comment
There was a problem hiding this comment.
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
Reviewed 10 of 10 changed files.
Found one polymorphic-deserialization issue: an explicit unknown streaming partition type silently falls back to the built-in strategy instead of failing.
This is an automated review by Codex GPT-5.6-Sol
FrankChen021
left a comment
There was a problem hiding this comment.
I have reviewed the updated code for correctness, edge cases, concurrency, and integration risks; no issues found. The incremental fix rejects explicit unknown type IDs while preserving the omitted-type default.
Reviewed 10 of 10 changed files.
This is an automated review by Codex GPT-5.6-Sol
This is a follow-up to #19571. This patch addresses this review comment #19571 (comment) 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: