diff --git a/go/libraries/doltcore/mvdata/pipeline.go b/go/libraries/doltcore/mvdata/pipeline.go index f15b48fc2b..4bb64b9f2a 100644 --- a/go/libraries/doltcore/mvdata/pipeline.go +++ b/go/libraries/doltcore/mvdata/pipeline.go @@ -57,7 +57,6 @@ func (e *DataMoverPipeline) Execute() error { for { row, err := e.rd.ReadSqlRow(e.ctx) if err == io.EOF { - parsedRowChan <- nil return nil } diff --git a/go/libraries/doltcore/table/typed/json/writer.go b/go/libraries/doltcore/table/typed/json/writer.go index f5690e13b7..e4daa0b330 100644 --- a/go/libraries/doltcore/table/typed/json/writer.go +++ b/go/libraries/doltcore/table/typed/json/writer.go @@ -124,9 +124,6 @@ func (jsonw *JSONWriter) WriteRow(ctx context.Context, r row.Row) error { } func (jsonw *JSONWriter) WriteSqlRow(ctx context.Context, row sql.Row) error { - if row == nil { - return nil - } allCols := jsonw.sch.GetAllCols() colValMap := make(map[string]interface{}, allCols.Size()) if err := allCols.Iter(func(tag uint64, col schema.Column) (stop bool, err error) { diff --git a/go/libraries/doltcore/table/typed/parquet/writer.go b/go/libraries/doltcore/table/typed/parquet/writer.go index 46a58313fb..e21d625134 100644 --- a/go/libraries/doltcore/table/typed/parquet/writer.go +++ b/go/libraries/doltcore/table/typed/parquet/writer.go @@ -131,9 +131,6 @@ func (pwr *ParquetWriter) WriteRow(ctx context.Context, r row.Row) error { } func (pwr *ParquetWriter) WriteSqlRow(ctx context.Context, r sql.Row) error { - if r == nil { - return nil - } colValStrs := make([]*string, pwr.sch.GetAllCols().Size()) for i, val := range r { diff --git a/go/libraries/doltcore/table/untyped/csv/writer.go b/go/libraries/doltcore/table/untyped/csv/writer.go index 32816d63c5..89c009609c 100644 --- a/go/libraries/doltcore/table/untyped/csv/writer.go +++ b/go/libraries/doltcore/table/untyped/csv/writer.go @@ -105,9 +105,6 @@ func (csvw *CSVWriter) WriteRow(ctx context.Context, r row.Row) error { } func (csvw *CSVWriter) WriteSqlRow(ctx context.Context, r sql.Row) error { - if r == nil { - return nil - } colValStrs := make([]*string, csvw.sch.GetAllCols().Size()) for i, val := range r { if val == nil { diff --git a/go/libraries/doltcore/table/untyped/sqlexport/batch_sqlwriter.go b/go/libraries/doltcore/table/untyped/sqlexport/batch_sqlwriter.go index 644e470bcf..988cb63fb7 100644 --- a/go/libraries/doltcore/table/untyped/sqlexport/batch_sqlwriter.go +++ b/go/libraries/doltcore/table/untyped/sqlexport/batch_sqlwriter.go @@ -141,11 +141,6 @@ func (w *BatchSqlExportWriter) WriteSqlRow(ctx context.Context, r sql.Row) error return err } - // Previous write was last insert - if w.numInserts > 0 && r == nil { - return iohelp.WriteLine(w.wr, ";") - } - // Reached max number of inserts on one line if w.numInserts == batchSize { // Reset count @@ -219,6 +214,14 @@ func (w *BatchSqlExportWriter) Close(ctx context.Context) error { return err } + // if wrote at least 1 insert, write the semicolon + if w.numInserts > 0 { + err := iohelp.WriteLine(w.wr, ";") + if err != nil { + return err + } + } + if w.wr != nil { return w.wr.Close() }