Commit 4668b6e
authored
fix(layout): don't panic collecting an empty stream (#8472)
## Summary
`CollectStrategy` collects its whole input into a single chunk for a
child that requires exactly one chunk. When the input stream is empty,
e.g. writing a zero-row table with a nullable struct column whose
validity substream is empty, no chunk supplied a sequence id and it
panicked with `must have visited at least one chunk`. `CollectStrategy`
now yields nothing on empty input, and `FlatLayoutStrategy` returns an
empty `ChunkedLayout` instead of requiring a single chunk, so no segment
is written for an empty array.
The issue mentions the fuzzer's `assume()` guard could be dropped once
this is fixed. I left it in place here: reading a nullable struct nested
in a struct back is a separate bug (#8348), so the round-trip only works
once both are fixed.
Closes: #8347
## Testing
Added a regression test in `vortex-file/tests/test_write_table.rs` that
writes a zero-row nullable struct column; it panicked before this change
and now writes and reads back as zero rows. The issue's Python repro
(`vx.io.write` of an empty `struct` column) no longer panics. `cargo
nextest run -p vortex-layout -p vortex-file` passes (177 tests,
including the segment-ordering tests). `fmt --all` + `clippy
--all-targets --all-features` clean.
---
I'm Korean, so sorry if any wording reads a little awkward.
---------
Signed-off-by: Han Damin <miniex@daminstudio.net>1 parent f793584 commit 4668b6e
3 files changed
Lines changed: 58 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
65 | | - | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
108 | 116 | | |
109 | 117 | | |
110 | 118 | | |
| |||
0 commit comments