← Back to Pull requests

[core] Read single-run primary-key sections without sort merge #1164

Closed
unknown closed this pull request without merging on Nov 05, 2026 11:01 UTC
View on GitHub
unknown unknown commented on Oct 18, 2026 14:09 UTC
Author

Purpose

Linked issue: close #1163

Brief change log

KeyValueFileReader::read skips the sort merge for a section with one sorted run under the deduplicate or first-row engine. A run should hold one version per key, but files written before #839 can repeat a key whatever engine the schemas name, so the unmerged path holds one batch back and compares adjacent keys; at the first repeated key it hands the held batch and the rest of the run to the sort merge. Each batch still drops retract rows the way the merge handles a lone version, and first-row without ignore-delete rejects them. That's needed because older Rust writers recorded delete_row_count = 0 for files holding DELETE rows. read_with_merge_function (audit log) always merges. Other sections merge as before.

Four disjoint level-0 files in one split, 2M rows: 102 ms → 18 ms on current main (4 rounds alternating on one instance, ranges don't overlap). Overlapping sections take the merge path unchanged.

Tests

  • pk_single_run_read_test: three disjoint files in one split read back once each, with a value-only projection and a residual filter; overlapping one of them still merges to the newer value.

  • single_run_read_drops_retracts_hidden_by_legacy_metadata: a two-file run whose second file holds a DELETE with delete_row_count = 0 reads [1, 2] under deduplicate and first-row with ignore-delete, and errors under first-row.

  • single_run_read_merges_*: a deduplicate-schema file that repeats a key, files written under aggregation and then ALTERed, the same files read through time travel and dynamic options, and a key repeated across one-row batches after earlier rows went out. All fail with the repeated-key check turned off.

  • dv_merge_on_read_loads_deletion_vectors_per_file asserted the first batch had 128 rows, the merge's output size. Its delete-free files now stream unmerged, so it checks the batch is non-empty; the lazy DV loading it covers is unchanged.
  • Ran the ci.yml steps locally (fmt, clippy, msrv, unit, rest-server, integration, datafusion, python, go).

    API and Format

    None.

    Documentation

    None.

    Diff: 267 lines (+200 / -67) across 3 files Reviewer: JeonDaehong Review duration: 25732m
    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
    0.39
    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.334
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1164"
    general weight: 0.35
    Reviewers
    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: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    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: 15.6% · Safe to merge
    15.6%