Repository navigation
fix(arrow-ipc): honor skip_validation for record batches in StreamDecoder - #12094
Conversation
…oder `StreamDecoder::with_skip_validation` only reached dictionary batches, so record batches were still validated. Pass the flag to `RecordBatchDecoder` as `StreamReader` and `FileDecoder` do, and cover `StreamDecoder` in `expect_ipc_validation_error`.
Rich-T-kid
left a comment
There was a problem hiding this comment.
thanks @comphead, ill wait to run the benchmarks before merging
|
run benchmark ipc_reader |
|
🤖 Benchmark starting (GKE) | trigger Target: ipc_reader Sharding factor: 1 (1 workers). Comparing stream-decoder-skip-validation (2812df6) to 71a9574 (merge-base) diff Run configurationrun benchmark ipc_reader
env:
BENCH_FILTER: StreamDecoder
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
run benchmark ipc_reader |
|
🤖 Benchmark starting (GKE) | trigger Target: ipc_reader Sharding factor: 1 (1 workers). Comparing stream-decoder-skip-validation (2812df6) to 71a9574 (merge-base) diff Run configurationrun benchmark ipc_reader
env:
BENCH_FILTER: StreamDecoder
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: ipc_reader Comparing stream-decoder-skip-validation (2812df6) to 71a9574 (merge-base) diff Run configurationrun benchmark ipc_reader
env:
BENCH_FILTER: StreamDecoder
shards: 1
DetailsPer-runner informationipc_reader — shard 1/1Node: gk3-benchmark-cluster-nap-hn34dqn7-a7b7f634-dk47 Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_readerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: ipc_reader Comparing stream-decoder-skip-validation (2812df6) to 71a9574 (merge-base) diff Run configurationrun benchmark ipc_reader
env:
BENCH_FILTER: StreamDecoder
shards: 1
DetailsPer-runner informationipc_reader — shard 1/1Node: gk3-benchmark-cluster-nap-hn34dqn7-a7b7f634-gdwg Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_readerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
Rich-T-kid
left a comment
There was a problem hiding this comment.
nice 😄, thanks @comphead
arrow_ipc_reader/StreamDecoder/no_validation/read_10 18.77 310.2±25.97µs ? ?/sec 1.00 16.5±0.25µs ? ?/sec
|
Thanks @Rich-T-kid I'll create a 60.2.0 backport |
I don’t think there’s a backport to do. I think 60.2 will be released from the main branch. |
Which issue does this PR close?
This picks up #11552 by @Dandandan with the same fix, rebased on
main. The benchmarks are split out into #12093.Rationale for this change
StreamDecoder::with_skip_validation(true)only applies to dictionary batches, so record batches are still fully validated.StreamReader,FileDecoderand thearrow-flightFlightDataDecoderall pass the flag through for record batches too.DataFusion's spill reader has called
StreamDecoder::new().with_skip_validation(true)since apache/datafusion#21882. Because of this bug, every spilled batch is validated again when it is read back, including a UTF-8 check of every string. That undoes apache/datafusion#15454.What changes are included in this PR?
skip_validationtoRecordBatchDecoderinStreamDecoder::decode.StreamDecoderinexpect_ipc_validation_error.Are these changes tested?
Yes.
expect_ipc_validation_errornow checks thatStreamDecoderrejects invalid data by default and accepts it when validation is skipped. Without the fix, the fivetest_validation_of_invalid_*tests fail on the new check.Benchmarks from #12093 on an M5 Max,
mainagainst this PR:StreamDecoder/no_validation/read_10StreamDecoder/read_10The
StreamReaderandFileReaderbenchmarks do not change. With arrow patched to this branch, DataFusion'sspill_io/StreamReader/read_100drops from 9.59 ms to 8.48 ms (−11.5%). That benchmark reads 100 spilled batches of 8192 rows throughStreamDecoder.After #12093 merges, rebasing this PR lets
run benchmark ipc_readerconfirm these numbers on the shared runner.Are there any significant user-facing changes?
No API changes, and validation is still on by default. Callers that pass
truenow skip validation for record batches too, as documented.AI disclosure: The fix, the test and this description were written with Claude Code. I have reviewed every change and the benchmark results.