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 {
101101 }
102102 this . schema = schema ;
103103 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 ) ) ;
105107 this . length = this . batchesUnion . length ;
106108 this . numCols = this . batchesUnion . numCols ;
107109 }
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ const {
2424} = Arrow ;
2525
2626describe ( `Table` , ( ) => {
27+ test ( `can create an empty table` , ( ) => {
28+ expect ( Table . empty ( ) . length ) . toEqual ( 0 )
29+ } ) ;
30+
2731 describe ( `single record batch` , ( ) => {
2832 const table = Table . from ( {
2933 'schema' : {
You can’t perform that action at this time.
0 commit comments