File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,9 @@ export class Table implements DataFrame {
101
101
}
102
102
this . schema = schema ;
103
103
this . batches = batches ;
104
- this . batchesUnion = batches . reduce ( ( union , batch ) => union . concat ( batch ) ) ;
104
+ this . batchesUnion = batches . length == 0 ?
105
+ new RecordBatch ( schema , 0 , [ ] ) :
106
+ batches . reduce ( ( union , batch ) => union . concat ( batch ) ) ;
105
107
this . length = this . batchesUnion . length ;
106
108
this . numCols = this . batchesUnion . numCols ;
107
109
}
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ const {
24
24
} = Arrow ;
25
25
26
26
describe ( `Table` , ( ) => {
27
+ test ( `can create an empty table` , ( ) => {
28
+ expect ( Table . empty ( ) . length ) . toEqual ( 0 )
29
+ } ) ;
30
+
27
31
describe ( `single record batch` , ( ) => {
28
32
const table = Table . from ( {
29
33
'schema' : {
You can’t perform that action at this time.
0 commit comments