25
25
make_vec_none ,
26
26
offsets_starting_at_zero ,
27
27
unsafe_awl_construction ,
28
+ safe_list_array_from_arrays
28
29
)
29
30
from weave_query .language_features .tagging import tagged_value_type
30
31
@@ -209,21 +210,15 @@ def _concatenate_lists(
209
210
]
210
211
)
211
212
212
- result_array = pa . ListArray . from_arrays (
213
+ result_array = safe_list_array_from_arrays (
213
214
new_offsets ,
214
215
concatted_values ._arrow_data ,
216
+ mask = pa_concat_arrays ([
217
+ pa .compute .is_null (l1 ._arrow_data ),
218
+ pa .compute .is_null (l2 ._arrow_data )
219
+ ])
215
220
)
216
221
217
- # In pyarrow 17.0.0, we can only use either null offsets OR provide a mask,
218
- # so track the null values to convert empty lists (that were null before
219
- # conversion) and convert those empty lists to None before returning the AWL
220
- combined_nulls = pa_concat_arrays ([
221
- pa .compute .is_null (l1 ._arrow_data ),
222
- pa .compute .is_null (l2 ._arrow_data )
223
- ])
224
-
225
- result_array = pc .if_else (combined_nulls , None , result_array )
226
-
227
222
return ArrowWeaveList (
228
223
result_array ,
229
224
types .List (
@@ -520,7 +515,6 @@ def _concatenate(
520
515
pa .array (np .zeros (len (other ), dtype = np .int8 )),
521
516
]
522
517
),
523
- # offsets=pa.array(np.arange(len(self), dtype=np.int32)),
524
518
offsets = pa_concat_arrays (
525
519
[
526
520
self_offsets ,
@@ -547,7 +541,6 @@ def _concatenate(
547
541
pa .compute .equal (other_type_codes , other_i ).cast (pa .int8 ()),
548
542
]
549
543
),
550
- # offsets=pa.array(np.arange(len(other), dtype=np.int32)),
551
544
offsets = pa_concat_arrays (
552
545
[
553
546
pa .array (np .zeros (len (self ), dtype = np .int32 )),
0 commit comments