@@ -59,13 +59,22 @@ pub struct SequenceMetadata {
5959 multiplier : Option < vortex_proto:: scalar:: ScalarValue > ,
6060}
6161
62+ /// Components of [`SequenceArray`].
63+ pub struct SequenceArrayParts {
64+ pub base : PValue ,
65+ pub multiplier : PValue ,
66+ pub len : usize ,
67+ pub ptype : PType ,
68+ pub nullability : Nullability ,
69+ }
70+
6271#[ derive( Clone , Debug ) ]
6372/// An array representing the equation `A[i] = base + i * multiplier`.
6473pub struct SequenceArray {
6574 base : PValue ,
6675 multiplier : PValue ,
6776 dtype : DType ,
68- pub ( crate ) length : usize ,
77+ pub ( crate ) len : usize ,
6978 stats_set : ArrayStats ,
7079}
7180
@@ -124,7 +133,7 @@ impl SequenceArray {
124133 base,
125134 multiplier,
126135 dtype,
127- length,
136+ len : length,
128137 // TODO(joe): add stats, on construct or on use?
129138 stats_set : Default :: default ( ) ,
130139 }
@@ -164,7 +173,7 @@ impl SequenceArray {
164173 }
165174
166175 pub ( crate ) fn index_value ( & self , idx : usize ) -> PValue {
167- assert ! ( idx < self . length , "index_value({idx}): index out of bounds" ) ;
176+ assert ! ( idx < self . len , "index_value({idx}): index out of bounds" ) ;
168177
169178 match_each_native_ptype ! ( self . ptype( ) , |P | {
170179 let base = self . base. cast:: <P >( ) ;
@@ -177,9 +186,19 @@ impl SequenceArray {
177186
178187 /// Returns the validated final value of a sequence array
179188 pub fn last ( & self ) -> PValue {
180- Self :: try_last ( self . base , self . multiplier , self . ptype ( ) , self . length )
189+ Self :: try_last ( self . base , self . multiplier , self . ptype ( ) , self . len )
181190 . vortex_expect ( "validated array" )
182191 }
192+
193+ pub fn into_parts ( self ) -> SequenceArrayParts {
194+ SequenceArrayParts {
195+ base : self . base ,
196+ multiplier : self . multiplier ,
197+ len : self . len ,
198+ ptype : self . dtype . as_ptype ( ) ,
199+ nullability : self . dtype . nullability ( ) ,
200+ }
201+ }
183202}
184203
185204impl VTable for SequenceVTable {
@@ -355,7 +374,7 @@ fn execute_iter<P: NativePType, I: Iterator<Item = usize>>(
355374
356375impl BaseArrayVTable < SequenceVTable > for SequenceVTable {
357376 fn len ( array : & SequenceArray ) -> usize {
358- array. length
377+ array. len
359378 }
360379
361380 fn dtype ( array : & SequenceArray ) -> & DType {
@@ -374,14 +393,14 @@ impl BaseArrayVTable<SequenceVTable> for SequenceVTable {
374393 array. base . hash ( state) ;
375394 array. multiplier . hash ( state) ;
376395 array. dtype . hash ( state) ;
377- array. length . hash ( state) ;
396+ array. len . hash ( state) ;
378397 }
379398
380399 fn array_eq ( array : & SequenceArray , other : & SequenceArray , _precision : Precision ) -> bool {
381400 array. base == other. base
382401 && array. multiplier == other. multiplier
383402 && array. dtype == other. dtype
384- && array. length == other. length
403+ && array. len == other. len
385404 }
386405}
387406
0 commit comments