File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ import { Col, Predicate } from './predicate';
20
20
import { Schema , Field , Struct } from './type' ;
21
21
import { read , readAsync } from './ipc/reader/arrow' ;
22
22
import { isPromise , isAsyncIterable } from './util/compat' ;
23
- import { Vector , DictionaryVector , IntVector } from './vector' ;
23
+ import { Vector , DictionaryVector , IntVector , StructVector } from './vector' ;
24
+ import { ChunkedView } from './vector/chunked' ;
24
25
25
26
export type NextFunc = ( idx : number , cols : RecordBatch ) => void ;
26
27
@@ -61,6 +62,13 @@ export class Table implements DataFrame {
61
62
}
62
63
return Table . empty ( ) ;
63
64
}
65
+ static fromStruct ( struct : StructVector ) {
66
+ const schema = new Schema ( struct . type . children ) ;
67
+ const chunks = struct . view instanceof ChunkedView ?
68
+ ( struct . view . childVectors as StructVector [ ] ) :
69
+ [ struct ] ;
70
+ return new Table ( chunks . map ( ( chunk ) => new RecordBatch ( schema , chunk . length , chunk . view . childData ) ) ) ;
71
+ }
64
72
65
73
public readonly schema : Schema ;
66
74
public readonly length : number ;
You can’t perform that action at this time.
0 commit comments