Skip to content

Commit

Permalink
removed empty key during streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Apr 15, 2019
1 parent 5dffb63 commit f4b6be3
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"github.com/viant/dsc"
"github.com/viant/toolbox"
"github.com/viant/toolbox/data"
"golang.org/x/net/context"
"google.golang.org/api/bigquery/v2"
"google.golang.org/api/googleapi"
Expand Down Expand Up @@ -136,14 +135,6 @@ func (it *InsertTask) asMap(record interface{}) map[string]interface{} {
return jsonValues
}

func buildRecord(record map[string]interface{}) map[string]interface{} {
result := data.NewMap()
for k, v := range toolbox.AsMap(record) {
result.SetValue(k, v)
}
return toolbox.DeleteEmptyKeys(result)
}

func (it *InsertTask) buildLoadData(data interface{}) (io.Reader, int, error) {
compressed := NewCompressed(nil)
ranger, ok := data.(toolbox.Ranger)
Expand Down Expand Up @@ -247,7 +238,7 @@ func (it *InsertTask) StreamAll(data interface{}) (int, error) {
for i < len(records) {
var rows = make([]*bigquery.TableDataInsertAllRequestRows, 0)
for ; i < len(records); i++ {
record := buildRecord(toolbox.AsMap(records[i]))
record := toolbox.AsMap(records[i])
rows = append(rows, &bigquery.TableDataInsertAllRequestRows{InsertId: it.insertID(record), Json: it.asJSONMap(record)})
if len(rows) >= streamBatchCount {
break
Expand Down

0 comments on commit f4b6be3

Please sign in to comment.