@@ -9,20 +9,23 @@ use num_traits::AsPrimitive;
99use vortex_buffer:: Buffer ;
1010use vortex_buffer:: BufferMut ;
1111use vortex_error:: VortexResult ;
12+ use vortex_error:: vortex_bail;
1213use vortex_error:: vortex_ensure;
1314use vortex_error:: vortex_err;
1415use vortex_mask:: AllOr ;
1516use vortex_mask:: Mask ;
1617
1718use crate :: ArrayRef ;
19+ use crate :: Canonical ;
20+ use crate :: Columnar ;
1821use crate :: IntoArray ;
1922use crate :: array:: ArrayView ;
2023use crate :: arrays:: PiecewiseSequence ;
2124use crate :: arrays:: PrimitiveArray ;
2225use crate :: arrays:: VarBinView ;
2326use crate :: arrays:: VarBinViewArray ;
2427use crate :: arrays:: dict:: TakeExecute ;
25- use crate :: arrays:: piecewise_sequence:: ConstantOrArray ;
28+ use crate :: arrays:: piecewise_sequence:: constant_unsigned_usize ;
2629use crate :: arrays:: piecewise_sequence:: maybe_contiguous_slices;
2730use crate :: arrays:: varbinview:: BinaryView ;
2831use crate :: buffer:: BufferHandle ;
@@ -83,18 +86,19 @@ fn take_contiguous_ranges(
8386 } ;
8487 let source = array. views ( ) ;
8588 let output_len = indices_ref. len ( ) ;
86- let views = match & lengths {
87- ConstantOrArray :: Constant ( length) => {
89+ let views = match lengths {
90+ Columnar :: Constant ( lengths) => {
91+ let length = constant_unsigned_usize ( & lengths) ?;
8892 match_each_unsigned_integer_ptype ! ( starts. ptype( ) , |S | {
8993 gather_view_slices_constant_length(
9094 source,
9195 starts. as_slice:: <S >( ) ,
92- * length,
96+ length,
9397 output_len,
9498 ) ?
9599 } )
96100 }
97- ConstantOrArray :: Array ( lengths) => {
101+ Columnar :: Canonical ( Canonical :: Primitive ( lengths) ) => {
98102 match_each_unsigned_integer_ptype ! ( starts. ptype( ) , |S | {
99103 match_each_unsigned_integer_ptype!( lengths. ptype( ) , |L | {
100104 gather_view_slices(
@@ -106,6 +110,12 @@ fn take_contiguous_ranges(
106110 } )
107111 } )
108112 }
113+ Columnar :: Canonical ( lengths) => {
114+ vortex_bail ! (
115+ "PiecewiseSequenceArray lengths must be primitive or constant, got {}" ,
116+ lengths. dtype( )
117+ )
118+ }
109119 } ;
110120 let validity = array. validity ( ) ?. take ( indices_ref) ?;
111121
0 commit comments