Repository navigation
Speed up writes of wide sparse structs - #12343
robert3005 wants to merge 5 commits into
Conversation
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
lwwmanning
left a comment
There was a problem hiding this comment.
Posted by Claude Opus 5.5 on Will's behalf.
I reviewed 1d7908f and found no problems. I read the code but did not run the tests.
The new SequenceId list looks right. Every path takes its locks from the earlier position to the later one, so I see no deadlock. When the head leaves, it clears the next position and takes its waker under that position's lock, so a wake cannot be lost. Descend keeps the parent's position, and advance inserts the sibling after it, so the order matches the IDs.
The null-run merge is also safe. It only merges consecutive absent batches, and it writes the run under the last of their IDs, so no other batch falls inside the run. The struct reader masks children with the parent validity, so readers cannot see the replaced hidden values.
One optional gap: no test checks that consecutive absent batches merge into one write, or that a run stops at MAX_NULL_RUN_ROWS. The round-trip test passes with or without the merge.
|
At All five sparse-wide files were byte-identical to the writer containing #11160. I also checked the two 100,000-row review fixtures with 16 nullable float fields. The singleton fixture returned from 11,000 to 5,116 bytes and the four-batch fixture from 9,496 to 5,020 bytes, both byte-identical to the base. All seven files round-tripped to the source Arrow data. Both new regression tests failed on the previous PR head and passed on this commit. Earlier paired EC2 measurementsI compared
The target’s cold write fell from 319.5 to 47.5 ms. Hot reads took 18.7 ms on the base and 18.3 ms on the PR. Both wrote 1,176,956 bytes, compared with 1,540,074 bytes for Parquet. The two local writes were also byte-identical. Every Arrow field and validity mask matched the source in full 100,000-row round trips of the nested, nested-child-null, flat and shuffled-list fixtures. The base CPU profile spent 23.9% of samples advancing sequence positions and 25.4% dropping them. Those inclusive shares fell to 0.7% and 1.3% on the PR. I used the repository’s The repository’s Graviton run measured 256.6 → 34.4 ms hot and 259.9 → 35.5 ms cold on the target. Parquet took 55.0 and 55.2 ms. Inspecting the Vortex file confirmed that all 300 integer leaves use sparse encoding with sequence indices and bit-packed values. The 100 outer validity masks use run-end encoding, and all 300 inner masks are constant. Earlier CI run The CI read timings deserve a separate look. Target hot decode rose 15.87 → 16.71 ms in CI and fell 18.69 → 18.33 ms in the eight paired EC2 runs. On the 100-column, 50-chunk table, CI cold decode rose 1.80 → 2.49 ms. The three paired EC2 runs measured 2.14 → 2.12 ms, and the earlier PR also measured 2.42 ms on its head. Flat sparse runs showed a cold-read increase in both CI (12.51 → 15.61 ms) and the three EC2 pairs (14.31 → 15.91 ms). Earlier PR benchmark |
Polar Signals Profiling ResultsLatest Run
Previous Runs (1)
Powered by Polar Signals Cloud |
Benchmarks: Compression 📖Commits: PR vortex / vortex-file-compressed / ns (0.870x ✅, 6↓ 0↑)
vortex / vortex-file-compressed / bytes (1.000x ➖, 0↓ 0↑)
vortex / vortex-compact / bytes (1.000x ➖, 0↓ 0↑)
vortex / parquet / ns (0.997x ➖, 0↓ 0↑)
vortex / parquet / bytes (1.000x ➖, 0↓ 0↑)
vortex / parquet-snappy / bytes (1.000x ➖, 0↓ 0↑)
vortex / arrow-ipc / ns (0.998x ➖, 1↓ 0↑)
vortex / arrow-ipc / bytes (1.000x ➖, 0↓ 0↑)
|
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Wide sparse structs send absent batches through every nested field and make all writer tasks contend on the same ordered set. The writer now combines consecutive absent struct batches before splitting them into fields, and updates only neighboring sequence positions to preserve deterministic segment order. Merged runs use the same field normalization as individual batches.
On the Graviton runner, hot writes of
sparse-wide-nested-runsfell from 256.6 ms to 34.0 ms, versus 55.4 ms for Parquet. All five sparse-wide fixtures were byte-identical to the #11160 writer. Benchmark resultsFollows #11160.
OpenAI Codex assisted with this change.