You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: teach list builder to slice off trailing garbage (#2514)
ListArray is allowed to have a final offset less than the length of its
elements. E.g.:
```
1, 2, 3, 4, 5
```
with the offsets:
```
0, 2, 4
```
the lists are:
```
[1, 2], [3, 4]
```
The element five is included in no lists.
let cursor = O::from_usize(cursor_usize).ok_or_else(|| {
124
+
vortex_err!(
125
+
"cannot convert length {} to type {:?}",
126
+
cursor_usize,
127
+
O::PTYPE
128
+
)
129
+
})?;
124
130
125
131
let offsets = binary_numeric(
126
132
&try_cast(
127
133
&slice(list.offsets(),1, list.offsets().len())?,
128
134
&DType::Primitive(O::PTYPE,NonNullable),
129
135
)?,
130
-
&ConstantArray::new(
131
-
O::from_usize(offset).ok_or_else(|| {
132
-
vortex_err!("cannot convert offset {} to type {:?}", offset,O::PTYPE)
133
-
})?,
134
-
list.len(),
135
-
),
136
+
&ConstantArray::new(cursor, list.len()),
136
137
BinaryNumericOperator::Add,
137
138
)?;
138
139
self.index_builder.extend_from_array(&offsets)?;
139
140
141
+
if !list.is_empty(){
142
+
let last_used_index = self.index_builder.values().last().vortex_expect("there must be at least one index because we just extended a non-zero list of offsets");
0 commit comments