Commit 960acf6
authored
fix: take_into mask length must equal _indices_ length (#2396)
I added a test that catches this behavior. In particular, the indices
must differ in length from the array and also it must be either all
valid or all invalid.
I additionally changed `Validity::to_logical` to assert the length
matches the array length. Since mixed validity is more common than the
other two, I hope this new assertion will surface these kinds of issues
in more tests.
An example of a failure on `develop` with these new tests:
```
---- array::primitive::compute::take::test::test_take_into stdout ----
thread 'array::primitive::compute::take::test::test_take_into' panicked at vortex-array/src/builders/primitive.rs:98:9:
assertion `left == right` failed: null count must equal value count
left: 5
right: 3
stack backtrace:
0: rust_begin_unwind
at /rustc/409998c4e8cae45344fd434b358b697cc93870d0/library/std/src/panicking.rs:676:5
1: core::panicking::panic_fmt
at /rustc/409998c4e8cae45344fd434b358b697cc93870d0/library/core/src/panicking.rs:75:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /rustc/409998c4e8cae45344fd434b358b697cc93870d0/library/core/src/panicking.rs:364:5
4: vortex_array::builders::primitive::PrimitiveBuilder<T>::finish_into_primitive
at ./src/builders/primitive.rs:98:9
5: <vortex_array::builders::primitive::PrimitiveBuilder<T> as vortex_array::builders::ArrayBuilder>::finish
at ./src/builders/primitive.rs:176:9
6: vortex_array::array::primitive::compute::take::test::test_take_into
at ./src/array/primitive/compute/take.rs:150:22
7: vortex_array::array::primitive::compute::take::test::test_take_into::{{closure}}
at ./src/array/primitive/compute/take.rs:142:24
```1 parent 3883c7a commit 960acf6
File tree
3 files changed
+70
-6
lines changed- vortex-array/src
- array/primitive/compute
- compute
- vortex-dtype/src
3 files changed
+70
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
110 | | - | |
| 113 | + | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
| |||
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
138 | 188 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
228 | 230 | | |
229 | | - | |
| 231 | + | |
230 | 232 | | |
231 | | - | |
232 | | - | |
| 233 | + | |
| 234 | + | |
233 | 235 | | |
234 | 236 | | |
235 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
13 | 25 | | |
14 | 26 | | |
15 | 27 | | |
| |||
0 commit comments