diff --git a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/GenericAvroJsonProvider.java b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/GenericAvroJsonProvider.java index 42195ca1b3f..ab6a53e5c7a 100644 --- a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/GenericAvroJsonProvider.java +++ b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/GenericAvroJsonProvider.java @@ -193,6 +193,6 @@ public class GenericAvroJsonProvider implements JsonProvider @Override public Object unwrap(final Object o) { - throw new UnsupportedOperationException("Unused"); + return o; } } diff --git a/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroFlattenerMakerTest.java b/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroFlattenerMakerTest.java index d3faaf412bf..6becdf7cf08 100644 --- a/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroFlattenerMakerTest.java +++ b/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroFlattenerMakerTest.java @@ -23,6 +23,8 @@ import org.apache.druid.data.input.AvroStreamInputRowParserTest; import org.apache.druid.data.input.SomeAvroDatum; import org.junit.Assert; import org.junit.Test; +import java.util.Collections; +import java.util.List; public class AvroFlattenerMakerTest { @@ -195,6 +197,22 @@ public class AvroFlattenerMakerTest record.getSomeRecordArray(), flattener.makeJsonPathExtractor("$.someRecordArray").apply(record) ); + + Assert.assertEquals( + record.getSomeRecordArray().get(0).getNestedString(), + flattener.makeJsonPathExtractor("$.someRecordArray[0].nestedString").apply(record) + ); + + Assert.assertEquals( + record.getSomeRecordArray(), + flattener.makeJsonPathExtractor("$.someRecordArray[?(@.nestedString)]").apply(record) + ); + + List nestedStringArray = Collections.singletonList(record.getSomeRecordArray().get(0).getNestedString().toString()); + Assert.assertEquals( + nestedStringArray, + flattener.makeJsonPathExtractor("$.someRecordArray[?(@.nestedString=='string in record')].nestedString").apply(record) + ); } @Test(expected = UnsupportedOperationException.class)