skip null field when ingest data

This commit is contained in:
Linh Vo 2017-07-18 10:16:10 -05:00
parent 13aeaebe35
commit 7b7f471a18
2 changed files with 15 additions and 1 deletions

View file

@ -1694,6 +1694,9 @@ func (h *Handler) InputJSONDataParser(req map[string]interface{}, index *Index,
for _, action := range field.Actions {
frame := action.Frame
timestamp := timestampFrame[action.Frame]
if req[field.Name] == nil {
continue
}
bit, err := HandleAction(action, req[field.Name], colValue, timestamp)
if err != nil {
return nil, fmt.Errorf("error handling action: %s, err: %s", action.ValueDestination, err)

View file

@ -1274,6 +1274,16 @@ var defaultBody = `
}
]
},
{
"name":"null_value",
"actions":[
{
"frame":"add-ons",
"valueDestination":"value-to-row"
}
]
},
{
"name":"time_value",
"actions":[
@ -1307,7 +1317,8 @@ func TestHandler_CreateInput(t *testing.T) {
"cabType": "yellow",
"distanceMiles": 8,
"withPet": true,
"time_value": "2017-03-20T19:35"
"time_value": "2017-03-20T19:35",
"null_value": null
}]`)
h := test.NewHandler()
h.Holder = hldr.Holder