chenboat commented on code in PR #14229:
URL: https://github.com/apache/pinot/pull/14229#discussion_r1803476287
##########
pinot-spi/src/test/java/org/apache/pinot/spi/utils/JsonUtilsTest.java:
##########
@@ -641,4 +641,71 @@ public void testEmptyString()
List<Map<String, String>> flattenedRecords = JsonUtils.flatten(jsonNode,
jsonIndexConfig);
assertTrue(flattenedRecords.isEmpty());
}
+
+ @Test
+ public void testFlattenWithIndexPaths()
+ throws IOException {
+ {
+ JsonNode jsonNode = JsonUtils.stringToJsonNode(
+ "[{\"country\":\"us\",\"street\":\"main
st\",\"number\":1},{\"country\":\"ca\",\"street\":\"second st\","
+ + "\"number\":2}]");
+ JsonIndexConfig jsonIndexConfig = new JsonIndexConfig();
+ List<Map<String, String>> flattenedRecords = JsonUtils.flatten(jsonNode,
jsonIndexConfig);
+
+ jsonIndexConfig.setIndexPaths(Collections.singleton("*.*"));
+ assertEquals(JsonUtils.flatten(jsonNode, jsonIndexConfig),
flattenedRecords);
+
+ jsonIndexConfig.setIndexPaths(Collections.singleton("a.*"));
+ flattenedRecords = JsonUtils.flatten(jsonNode, jsonIndexConfig);
+ assertTrue(flattenedRecords.isEmpty());
+ }
+ {
Review Comment:
Can you add comments on what each test case is about?
--
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]