@@ -19,7 +19,7 @@ import { popcnt_bit_range } from './util/bit';
19
19
import { VectorLike , Vector } from './vector' ;
20
20
import { VectorType , TypedArray , TypedArrayConstructor , Dictionary } from './type' ;
21
21
import { Int , Bool , FlatListType , List , FixedSizeList , Struct , Map_ } from './type' ;
22
- import { DataType , FlatType , ListType , NestedType , DenseUnion , SparseUnion } from './type' ;
22
+ import { DataType , FlatType , ListType , NestedType , SingleNestedType , DenseUnion , SparseUnion } from './type' ;
23
23
24
24
export function toTypedArray < T extends TypedArray > ( ArrayType : TypedArrayConstructor < T > , values ?: T | ArrayLike < number > | Iterable < number > | null ) : T {
25
25
if ( ! ArrayType && ArrayBuffer . isView ( values ) ) { return values ; }
@@ -46,7 +46,7 @@ export interface DataTypes<T extends DataType> {
46
46
/* [Type.Struct]*/ 13 : NestedData < Struct > ;
47
47
/* [Type.Union]*/ 14 : UnionData ;
48
48
/* [Type.FixedSizeBinary]*/ 15 : FlatData < T > ;
49
- /* [Type.FixedSizeList]*/ 16 : ListData < FixedSizeList < T > > ;
49
+ /* [Type.FixedSizeList]*/ 16 : SingleNestedData < FixedSizeList < T > > ;
50
50
/* [Type.Map]*/ 17 : NestedData < Map_ > ;
51
51
/* [Type.DenseUnion]*/ DenseUnion : DenseUnionData ;
52
52
/*[Type.SparseUnion]*/ SparseUnion : SparseUnionData ;
@@ -195,15 +195,21 @@ export class NestedData<T extends NestedType = NestedType> extends BaseData<T> {
195
195
}
196
196
}
197
197
198
- export class ListData < T extends ListType > extends NestedData < T > {
199
- public /* [VectorType.OFFSET]:*/ 0 : Int32Array ;
200
- public /*[VectorType.VALIDITY]:*/ 2 : Uint8Array ;
198
+ export class SingleNestedData < T extends SingleNestedType > extends NestedData < T > {
201
199
protected _valuesData : Data < T > ;
202
200
public get values ( ) { return this . _valuesData ; }
203
- public get valueOffsets ( ) { return this [ VectorType . OFFSET ] ; }
204
- constructor ( type : T , length : number , nullBitmap : Uint8Array | null | undefined , valueOffsets : Iterable < number > , valueChildData : Data < T > , offset ?: number , nullCount ?: number ) {
201
+ constructor ( type : T , length : number , nullBitmap : Uint8Array | null | undefined , valueChildData : Data < T > , offset ?: number , nullCount ?: number ) {
205
202
super ( type , length , nullBitmap , [ valueChildData ] , offset , nullCount ) ;
206
203
this . _valuesData = valueChildData ;
204
+ }
205
+ }
206
+
207
+ export class ListData < T extends ListType > extends SingleNestedData < T > {
208
+ public /* [VectorType.OFFSET]:*/ 0 : Int32Array ;
209
+ public /*[VectorType.VALIDITY]:*/ 2 : Uint8Array ;
210
+ public get valueOffsets ( ) { return this [ VectorType . OFFSET ] ; }
211
+ constructor ( type : T , length : number , nullBitmap : Uint8Array | null | undefined , valueOffsets : Iterable < number > , valueChildData : Data < T > , offset ?: number , nullCount ?: number ) {
212
+ super ( type , length , nullBitmap , valueChildData , offset , nullCount ) ;
207
213
this [ VectorType . OFFSET ] = toTypedArray ( Int32Array , valueOffsets ) ;
208
214
}
209
215
public clone < R extends T > ( type : R , length = this . _length , offset = this . _offset , nullCount = this . _nullCount ) {
0 commit comments