fix(write): flush retained input before dictionary encoding exhausts its budget #1329
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
JeonDaehong
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 releaseaccounting.
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_testpassed. 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.Table::new_write_builder().with_resources(...)with
write.parquet-buffer-size=1 mb. They write four separate dictionary-friendlybatches 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 -- --checkandgit diff --checkpassed.cargo +1.97.0 clippy --locked -p paimon --lib --test writer_resources_test --test postpone_native_write_test -- -D warningspassed.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-sizeand per-file retained-input accountingin the C writer resource guide.