somu-imply commented on code in PR #13712:
URL: https://github.com/apache/druid/pull/13712#discussion_r1092733985


##########
core/src/main/java/org/apache/druid/java/util/common/parsers/JSONFlattenerMaker.java:
##########
@@ -179,12 +179,13 @@ public static Object convertJsonNode(JsonNode val, 
CharsetEncoder enc)
       return ((BinaryNode) val).binaryValue();
     }
 
+
     if (val.isArray()) {
       List<Object> newList = new ArrayList<>();
       for (JsonNode entry : val) {
-        if (!entry.isNull()) {
-          newList.add(convertJsonNode(entry, enc));
-        }
+        // process nulls as is
+        // convertJsonNode will return null if the entry is null

Review Comment:
   Addressed :)
   



##########
core/src/test/java/org/apache/druid/data/input/impl/JSONParseSpecTest.java:
##########
@@ -113,6 +113,40 @@ public void testParseRowWithConditional()
     Assert.assertEquals(expected, parsedRow);
   }
 
+  @Test
+  public void testParseRowWithNullsInMVD()
+  {
+    final JSONParseSpec parseSpec = new JSONParseSpec(
+        new TimestampSpec("timestamp", "iso", null),
+        new 
DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("foo"))),
+        new JSONPathSpec(
+            true,
+            ImmutableList.of(
+                // https://github.com/apache/druid/issues/6653 $.x.y.z where y 
is missing
+                new JSONPathFieldSpec(JSONPathFieldType.PATH, "foo", 
"$.baz.[?(@.maybe_object)].maybe_object"),
+                // https://github.com/apache/druid/issues/6653 $.x.y.z where y 
is null
+                new JSONPathFieldSpec(JSONPathFieldType.PATH, "nullFoo", 
"$.nullFoo.[?(@.value)].foo"),
+                new JSONPathFieldSpec(JSONPathFieldType.PATH, "baz", "$.baz"),
+                new JSONPathFieldSpec(JSONPathFieldType.PATH, "bar", 
"$.[?(@.something_else)].something_else.foo")

Review Comment:
   Added 2 new cases



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to