← Back to Pull requests

fix(write): flush retained input before dictionary encoding exhausts its budget #1329

Closed
unknown closed this pull request without merging on Nov 10, 2026 01:18 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 08:35 UTC
Author

Purpose

Linked issue: Closes #1326.

Related to #911 (partial scope).

Repeated strings can retain several MiB of Arrow input while
producing a small Parquet dictionary. Checking only encoded size can exhaust
the input budget even when flushing the current file would allow writing to
continue. This addresses one part of the resource-governance issue.

Prepared with AI assistance. No throughput measurements are available.

Brief change log

Use the current format writer's retained-input reservation when deciding
whether to flush append and postpone-bucket files. Both paths flush when either
the encoded row-group size or the current file's reservation reaches
write.parquet-buffer-size. The flush uses the existing reservation release
accounting.

Tests

Validated on macOS arm64 with Rust 1.97.0.

  • cargo +1.97.0 test --locked -p paimon --lib --test writer_resources_test --test postpone_native_write_test passed. The core suite passed 4,804 tests with 6 ignored, the writer resource suite passed 12 tests, and the postpone write suite passed 6 tests.

  • Both new regressions use Table::new_write_builder().with_resources(...)

  • with write.parquet-buffer-size=1 mb. They write four separate dictionary-friendly
    batches of approximately 4 MiB under a 6 MiB budget, commit, and verify all
    4,096 rows in the output. On the previous PR head, the postpone case failed
    on the second write with ResourceExhausted.
  • cargo +1.97.0 fmt --all -- --check and git diff --check passed.

  • cargo +1.97.0 clippy --locked -p paimon --lib --test writer_resources_test --test postpone_native_write_test -- -D warnings passed.
  • API and Format

    Internal change; no public Rust or C API and no storage format change.
    Row-group boundaries can change with resource accounting. Formats whose flush
    is a no-op do not gain memory reclamation. Single-batch admission failures,
    background close overlap and allocations outside reservations remain unchanged.
    No spill, automatic retry or peak-memory guarantee is introduced.

    Documentation

    Document write.parquet-buffer-size and per-file retained-input accounting
    in the C writer resource guide.

    Diff: 271 lines (+203 / -68) across 3 files Reviewer: JeonDaehong Review duration: 6762m
    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 · 271 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.335
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1329"
    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.5% (MEDIUM) · Higher = larger blast radius
    39.5%
    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%