Skip to content

fix: skip validating spilled record batches again - #26688

Draft
comphead wants to merge 1 commit into
apache:mainfrom
comphead:spill-skip-validation
Draft

comphead wants to merge 1 commit into
apache:mainfrom
comphead:spill-skip-validation

Conversation

@comphead

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Since 55.0.0, reading a spill file validates every record batch again, including a UTF-8 check of every string. #15454 had turned that off, but StreamDecoder::with_skip_validation, which #21882 switched to, only applies to dictionary batches.

What changes are included in this PR?

SpillReaderStream already frames whole IPC messages. It now decodes them with RecordBatchDecoder and read_dictionary_impl, which take the skip_validation flag, instead of StreamDecoder.

spill_io benchmark, criterion medians averaged over two alternating runs:

benchmark main this PR change
spill_io/StreamReader/read_100 9.39 ms 8.25 ms -12%
spill_compression/q16/uncompressed 8.54 ms 7.94 ms -7%
spill_compression/wide/uncompressed 23.17 ms 21.80 ms -6%
spill_compression/q16/lz4_frame 22.65 ms 21.54 ms -5%
spill_compression/q16/zstd 40.31 ms 39.46 ms -2%

q2 and q20 have no strings and stay within noise.

What is the testing strategy for this PR?

test_spill_read_skips_validation spills a Utf8 value that is not UTF-8. It fails on main with Invalid UTF8 sequence at string index 0 and passes here. The existing spill tests cover decoding, including dictionaries and truncated files.

Are there any user-facing changes?

No.

apache#15454 stopped re-validating spill files on read. apache#21882 moved the reader to
`StreamDecoder`, whose `with_skip_validation` only applies to dictionary
batches, so every offset and string of a spilled record batch is validated
again. Decode the framed messages with `RecordBatchDecoder` instead, which
honors the flag.
@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Oct 23, 2026
@comphead

Copy link
Copy Markdown
Contributor Author

Related PR apache/arrow-rs#11552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spill files are validated again on read since 55.0.0

1 participant