walterddr commented on code in PR #12238: URL: https://github.com/apache/pinot/pull/12238#discussion_r1448175846
########## pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java: ########## @@ -719,4 +719,18 @@ private static void addFieldToPinotSchema(Schema pinotSchema, DataType dataType, } } } + + public static List<Map<String, String>> flatten(String jsonString, JsonIndexConfig jsonIndexConfig) throws IOException { + JsonNode jsonNode; + try { + jsonNode = JsonUtils.stringToJsonNode(jsonString); + } catch (IOException e) { + if (jsonIndexConfig.getSkipInvalidJson()) { + return Collections.singletonList(Collections.singletonMap(VALUE_KEY, SKIPPED_VALUE_REPLACEMENT)); Review Comment: why create this singleton at runtime? can't we make a static obj? ########## pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java: ########## @@ -719,4 +719,18 @@ private static void addFieldToPinotSchema(Schema pinotSchema, DataType dataType, } } } + + public static List<Map<String, String>> flatten(String jsonString, JsonIndexConfig jsonIndexConfig) throws IOException { + JsonNode jsonNode; + try { + jsonNode = JsonUtils.stringToJsonNode(jsonString); + } catch (IOException e) { Review Comment: i think the actual exception here we supposed to cathc is malform json exception only. all other issues should still throw --> e..g we should not return incorrect result or simply replace that with the default when there are other issues. -- 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