← Back to Pull requests

refactor: replace deprecated DataSegment constructors outside the server module #20795

Closed
unknown closed this pull request without merging on Oct 31, 2026 00:05 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 20:55 UTC
Author

Part of #20525.

Description

This is the second slice of the "DataSegment constructors and no-argument builder()" group from the table in #20525. The 9 and 10 argument DataSegment constructors and the no-argument DataSegment.builder() are deprecated in favour of DataSegment.builder(SegmentId), so I moved the remaining callers outside the server module over to the builder. The first slice (#20788) covered the deep storage extension tests. This one covers the other extensions (datasketches, histogram, compressed-bigdecimal, exact-count-bitmap, spectator-histogram, tdigestsketch, bloom-filter, stats), processing, sql, benchmarks, quidem-ut, indexing-service and multi-stage-query, which comes to 73 files and 176 calls. Only the server module is left, and that will be the last PR.

Each constructor call is now DataSegment.builder(SegmentId.of(dataSource, interval, version, partition)) followed by loadSpec, dimensions, metrics, shardSpec, binaryVersion and size. I set shardSpec, binaryVersion and size explicitly because the builder's defaults differ from what the old calls passed. Each no-argument builder() chain keeps all its setters, and dataSource, interval and version move into SegmentId.of. One chain in DruidSchemaInternRowSignatureBenchmark sets the interval later inside a loop, so I left it alone.

The no-argument builder() and the SegmentId builder also differ in two defaults: the old one starts with an empty loadSpec and a null binaryVersion, while the new one starts with a null loadSpec and binaryVersion 0. The three calls in main code (GeneratorSchemaInfo, KttmNestedComponentSupplier and TombstoneHelper) now set those two fields explicitly, so they build exactly the same segments as before. I didn't add them to the test chains. Test segments that never set a loadSpec now carry null instead of an empty map, which is what slice 1 did as well. I checked that none of the changed tests read loadSpec or binaryVersion from those segments. If you'd rather keep the old defaults in the tests too, I can add the two setters there.

Testing

Checkstyle and forbiddenapis pass for all the touched modules. I ran the unit tests of the changed classes with and without this change on my Windows machine and got the same results both times. CompactionTaskTest, TombstoneHelperTest, SegmentAllocateActionTest, the concurrent replace tests, KillUnusedSegmentsTaskTest and IndexerTableInputSpecSlicerTest pass. The tests that build real segments or start the SQL test framework (the SQL aggregator tests, MSQReplaceTest, TaskLifecycleTest and similar) fail the same way before and after, because of locked memory mapped temp files and colons in paths on Windows, so I'm relying on CI for those.

<hr>

##### Key changed/added classes in this PR
GeneratorSchemaInfo, KttmNestedComponentSupplier, TombstoneHelper
TombstoneHelperTest, SegmentAllocateActionTest, CompactionTaskTest, MSQReplaceTest and the other indexing-service and multi-stage-query tests
TestDataBuilder and the sql tests
the SQL aggregator tests in the datasketches, histogram, bloom-filter, stats and contrib extensions
* the processing tests and the benchmarks

<hr>

This PR has:

  • been self-reviewed.

  • a behaviour-preserving refactor covered by the existing unit tests of the changed classes.
  • PTAL @FrankChen021

    Diff: 417 lines (+312 / -105) across 5 files Reviewer: akshat-lakhera Review duration: 1630m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 417 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.361
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #20795"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.0% (MEDIUM) · Higher = larger blast radius
    45.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%
    Repository