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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org