fix(arrow/array): roll back JSON builder state after failed rows - #1113
fix(arrow/array): roll back JSON builder state after failed rows#1113fallintoplace wants to merge 10 commits into
Conversation
|
Thanks for this — the architecture here is sound and worth keeping: the checkpoint graph built once at construction, the parent-before-child restore ordering, the multibuffer/string-view truncation, and the memo-table rehashing all look correct. I found no refcount imbalance, no mutation of already-built arrays, and no hash entry left reachable after truncation. Your test suite is green, and That said, I think this needs changes before merge. Everything below was reproduced against Root causeThe rollback path uses 1.
|
0b09f34 to
724199f
Compare
Rationale for this change
RecordBuilder mutates field builders while decoding a JSON object. If a later field fails, values appended for earlier fields remain and can affect subsequent rows.
What changes are included in this PR?
Build the nested checkpoint graph once when the RecordBuilder is created. Each row captures reusable lengths and builder state, then restores that state on decode errors. This covers lists, structs, maps, fixed-size lists, unions, dictionaries, variable-width buffers, string views, and run-end encoded children without rebuilding checkpoint trees for every successful row.
Parent builders are restored before their children so parent Resize calls cannot overwrite restored child state. This is especially important for nested run-end encoded builders.
Custom builders with internal state can participate through the exported CheckpointState and CheckpointableBuilder interfaces.
Are these changes tested?
Are there any user-facing changes?
Yes. Failed JSON rows are rolled back completely, including nested builder state. This also adds two exported interfaces for custom builders that need to restore internal state during row rollback.