perf: reduce byte array materialization during Arrow export - #9339
perf: reduce byte array materialization during Arrow export#9339ClSlaid wants to merge 6 commits into
Conversation
Signed-off-by: cl <cailue@apache.org>
8890906 to
b95b97f
Compare
|
/cc @robert3005 This PR should restores the performance of #8902, please take a look. And this patch should not be an end, it is just a quick fix, not yet Current |
…y/min-materialization Signed-off-by: cl <cailue@apache.org>
803a21b to
d512ed9
Compare
Some types does not need that Signed-off-by: cl <cailue@apache.org>
Signed-off-by: cl <cailue@apache.org>
|
You should be able to execute away the filter and slice before you export? Why did you want to avoid this? If you really need implementing a execute parent (filter, varbin) -> varbin kernel would make sense? Or do you really to fuse filter + arrow export? |
None of them are avoided. The matcher was too tight and it will make Sadly those pathes decode and write into Meanwhile we already have direct decode implementations, it's fast and has less memory footprint, all in |
| /// first creating a canonical `VarBinView`. The default implementation creates a canonical array | ||
| /// first. The matcher continues execution for operators that can produce an array with a faster | ||
| /// export path. | ||
| struct ArrowByteExportable; |
There was a problem hiding this comment.
I think the fix here might be to not do this execution and just rely on builders
|
I've ignored some scenarios like |
Signed-off-by: cl <cailue@apache.org>
Signed-off-by: cl <cailue@apache.org>
|
I think the general solution looks like #9371. I have ported the benchmarks to that stack fwiw. Thanks for pointing this out |
Important
AI-assisted development disclosure
GPT-5.6 Sol assisted with this PR. A human reviewed the changes.
Validation ran 413 tests. The benchmark suite covers 744 planned scenarios. This value is scenario coverage. It is not source line coverage.
Benchmark results
The end-to-end benchmark reads one Utf8/FSST Vortex file. It exports the same input to Arrow
BinaryArrayandStringArray.Each value is the median wall time for one run.
The new matcher avoids an intermediate canonical
VarBinViewfor both Arrow output types.Representative direct Offset export results:
read_allhas no clear improvement. It returns a top-levelChunkedArray. The old matcher already used the specialized Chunked append path.Purpose
Arrow OffsetArray export can create an intermediate canonical
VarBinView. Some encodings can append directly to the Arrow offset builder. This PR uses the direct path when it is faster.Changes
Dict,Filter,ScalarFn, andSlice.vortex-arrow.vortexcrate.vortex-filefree of Arrow test dependencies.Scenario coverage
The string benchmark defines 180 input scenarios:
The benchmark runs these scenarios through three output paths:
A focused suite adds 24 nested operator scenarios for Arrow Offset export:
The total is 744 planned scenarios. The file benchmark adds four scenarios. It tests two Arrow output types and two scan collection modes.
Benchmark method
The old and new binaries used the same benchmark source and Cargo profile.
The benchmark created one in-memory Vortex file. The file contained 1,048,576 Utf8 rows in 16 chunks. The default compressor stored each scan batch as FSST. Both output cases read this same file.
The setup created the file before timing started. The timed region performed these steps:
StringArrayorBinaryArray.Each process used CPU 6. Each case used 80 samples. Divan used a minimum time of 2 seconds and a maximum time of 3 seconds. The run order was old/new, new/old, and old/new.
Command:
The direct Offset microbenchmarks ran on the same machine with the standard scheduler.
Known limitation
Some synthetic Zip scenarios are slower. Execution continues through
ScalarFnand stops at its result encoding. FSST Chunked Zip increased from 2.063 ms to 5.519 ms in the largest measured case. The end-to-end file benchmark does not use this lazy Zip path.Benchmark environment
Hardware
powersaveSoftware
bench, 16 codegen units, debug info enabled, LTO disabledThe machine ran a desktop session during the test. The test did not isolate the full system. CPU affinity limited each measured process to one logical CPU.
Validation
cargo nextest run -p vortex-arrow -p vortex-file -p vortex— 413 tests passed.cargo clippy -p vortex-arrow -p vortex --all-targets --all-features— passed.cargo clippy -p vortex --bench string_to_arrow --all-features— passed.cargo +nightly fmt --all -- --check— passed.git diff --check— passed.string_to_arrow --test— all 4 scenarios passed.to_arrow nested_string_export --test— all 24 scenarios passed.