Merge pull request #734 from linhvo/skip-null-field

skip null field when ingest data
This commit is contained in:
Linh Vo 2017-07-18 12:05:32 -05:00 • committed by GitHub
commit 1e91d10d70
2 changed files with 16 additions and 1 deletions

View file

@ -1694,6 +1694,10 @@ func (h *Handler) InputJSONDataParser(req map[string]interface{}, index *Index,
for _, action := range field.Actions {
frame := action.Frame
timestamp := timestampFrame[action.Frame]
// Skip input data field values that are set to null
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