somu-imply commented on code in PR #13712:
URL: https://github.com/apache/druid/pull/13712#discussion_r1092734459
##########
core/src/test/java/org/apache/druid/data/input/impl/JsonLineReaderTest.java:
##########
@@ -141,7 +141,7 @@ public void testParseRowWithConditional() throws IOException
while (iterator.hasNext()) {
final InputRow row = iterator.next();
Assert.assertEquals("test",
Iterables.getOnlyElement(row.getDimension("bar")));
- Assert.assertEquals(Collections.emptyList(), row.getDimension("foo"));
+ Assert.assertEquals("null", row.getDimension("foo").get(0));
Review Comment:
`foo` is in the JSONPathSpec. It comes out as [null] and then
`Rows.objectToStrings(event.get(dimension))` makes that. I have added comments
in the code
##########
extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroFlattenerMakerTest.java:
##########
@@ -210,6 +211,45 @@ public void testDiscovery()
);
}
+
+ @Test
+ public void testNullsInStringArray()
+ {
+ final AvroFlattenerMaker flattenerNested = new AvroFlattenerMaker(false,
false, true, true);
+
+ SomeAvroDatum input = AvroStreamInputRowParserTest.buildSomeAvroDatum();
+
+ Assert.assertEquals(
+ ImmutableSet.of(
+ "someStringValueMap",
+ "someOtherId",
+ "someStringArray",
+ "someIntArray",
+ "someFloat",
+ "isValid",
+ "someIntValueMap",
+ "eventType",
+ "someFixed",
+ "someBytes",
+ "someRecord",
+ "someMultiMemberUnion",
+ "someNull",
+ "someRecordArray",
+ "someUnion",
+ "id",
+ "someEnum",
+ "someLong",
+ "someInt",
+ "timestamp"
+ ),
+ ImmutableSet.copyOf(flattenerNested.discoverRootFields(input))
+ );
+
+ ArrayList<Object> results = (ArrayList<Object>)
flattenerNested.getRootField(input, "someStringArray");
+ // 4 strings a 1 null for a total of 5
+ Assert.assertEquals(5, results.size());
Review Comment:
Done
--
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]