mirror of https://github.com/apache/druid.git
Fix exception during ingestion
This commit is contained in:
parent
fa8ffe96d3
commit
5a5484b9ea
|
@ -86,7 +86,14 @@ public class JSONFlattenerMaker implements ObjectFlatteners.FlattenerMaker<JsonN
|
|||
public Function<JsonNode, Object> makeJsonPathExtractor(final String expr)
|
||||
{
|
||||
final JsonPath jsonPath = JsonPath.compile(expr);
|
||||
return node -> valueConversionFunction(jsonPath.read(node, JSONPATH_CONFIGURATION));
|
||||
return node -> {
|
||||
Object val = jsonPath.read(node, JSONPATH_CONFIGURATION);
|
||||
if (val instanceof JsonNode) {
|
||||
return valueConversionFunction((JsonNode) val);
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,17 +122,7 @@ public class JSONFlattenerMaker implements ObjectFlatteners.FlattenerMaker<JsonN
|
|||
}
|
||||
|
||||
@Nullable
|
||||
private Object valueConversionFunction(Object val)
|
||||
{
|
||||
if (val instanceof JsonNode) {
|
||||
return convertJsonNode((JsonNode) val);
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Object convertJsonNode(JsonNode val)
|
||||
private Object valueConversionFunction(JsonNode val)
|
||||
{
|
||||
if (val == null || val.isNull()) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue