diff --git a/api/src/test/java/io/druid/data/input/impl/JSONParseSpecTest.java b/api/src/test/java/io/druid/data/input/impl/JSONParseSpecTest.java index c7c73802f73..55622abcfe8 100644 --- a/api/src/test/java/io/druid/data/input/impl/JSONParseSpecTest.java +++ b/api/src/test/java/io/druid/data/input/impl/JSONParseSpecTest.java @@ -30,6 +30,7 @@ import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -79,6 +80,33 @@ public class JSONParseSpecTest Assert.assertNull(parsedRow.get("path_omg2")); } + @Test + public void testParseRowWithConditional() + { + final JSONParseSpec parseSpec = new JSONParseSpec( + new TimestampSpec("timestamp", "iso", null), + new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("foo")), null, null), + new JSONPathSpec( + true, + ImmutableList.of( + new JSONPathFieldSpec(JSONPathFieldType.PATH, "foo", "$.[?(@.maybe_object)].maybe_object.foo.test"), + new JSONPathFieldSpec(JSONPathFieldType.PATH, "bar", "$.[?(@.something_else)].something_else.foo") + ) + ), + null + ); + + final Map expected = new HashMap<>(); + expected.put("foo", new ArrayList()); + expected.put("bar", Arrays.asList("test")); + + final Parser parser = parseSpec.makeParser(); + final Map parsedRow = parser.parseToMap("{\"something_else\": {\"foo\": \"test\"}}"); + + Assert.assertNotNull(parsedRow); + Assert.assertEquals(expected, parsedRow); + } + @Test public void testSerde() throws IOException { diff --git a/java-util/pom.xml b/java-util/pom.xml index 7f0b462d9c5..62360df1c56 100644 --- a/java-util/pom.xml +++ b/java-util/pom.xml @@ -92,12 +92,6 @@ com.jayway.jsonpath json-path - - - net.minidev - json-smart - - net.thisptr diff --git a/pom.xml b/pom.xml index 0359fc52e64..51b66993563 100644 --- a/pom.xml +++ b/pom.xml @@ -638,7 +638,7 @@ com.jayway.jsonpath json-path - 2.1.0 + 2.3.0 net.thisptr