← Back to Pull requests

feat: add with_clustering_columns to the update table builder #12

Open
unknown opened this pull request with 319 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 17, 2026 14:58 UTC
Author

What changes are proposed in this pull request?

Adds UpdateTableTransactionBuilder::with_clustering_columns(Vec<ColumnName>) and its FFI setter update_table_txn_builder_with_clustering_columns.

  • If the setter is not called, the current keys stay. A non-empty list replaces the keys in order. It resolves case-insensitively against the final schema, so it can name columns added in the same transaction, and it stores physical paths in the delta.clustering domain. An empty list clears the keys.

  • Any clustering request adds clustering and domainMetadata when the protocol lacks them, and never removes them. Writes in the same transaction collect stats for the new keys.

  • build() rejects unresolved keys, duplicate keys (case-insensitive), ineligible types, and partitioned tables (including an empty list). No schema field is added or dropped, and no file is rewritten.

  • A clustering-only ALTER TABLE counts as a table change.

  • FFI keeps omitted and empty requests distinct, and copies path segments verbatim (dots are not separators).
  • Built on the update preparation from #10. Clustering resolves against the configuration that prepare_update_table_metadata returns, so prepare_update_table_metadata itself is unchanged. CREATE TABLE now shares resolve_physical_clustering_columns.

    Deviations from Java Kernel:

  • The partitioned-table check runs in build() (before any I/O), not in the setter, because Rust builder setters are infallible.

  • Duplicate keys are rejected. Java does not check for duplicates on update; the contract requires the check.

  • Clustering changes are rejected on blind appends, consistent with the existing schema and property rules. Java has no blind-append builder option.

  • Errors use KernelError because the Delta error catalog has no clustering condition selected.
  • How was this change tested?

    Unit tests cover the last call winning, which actions are emitted, the legacy-protocol upgrade, the Debug output, and the blind-append rejection. Integration tests cover reorder, replace, case-insensitive matching, enabling clustering, nested physical paths in none/name/id mapping modes, the empty list, the omitted setter, reasserting the current keys, resolving against columns added in the same transaction, a Write that changes keys and adds a file, every rejection with nothing committed, and the partitioned table with both the AlterTable and Write operations. An FFI test covers the omitted, empty, and dotted-segment cases.

    This pull request and its description were written by Isaac.

    Diff: 319 lines (+239 / -80) across 3 files Reviewer: nastra Review duration: 12580m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 319 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.345
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #12"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 40.4% (MEDIUM) · Higher = larger blast radius
    40.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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 21.6% · Safe to merge
    21.6%