zhztheplayer commented on a change in pull request #1075: [CALCITE-2881] Add
the JSON_PRETTY function
URL: https://github.com/apache/calcite/pull/1075#discussion_r261657913
##########
File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
##########
@@ -2676,6 +2675,15 @@ public static void jsonArrayAggAdd(List list, Object
element,
}
}
+ public static String jsonPretty(Object input) {
+ try {
+ return
JSON_PATH_JSON_PROVIDER.getObjectMapper().writerWithDefaultPrettyPrinter()
+ .writeValueAsString(input);
+ } catch (Exception e) {
+ return null;
Review comment:
This exception seems to be untrackable by user. For now I suggest to throw
something using tool class `org.apache.calcite.util.RESOURCE`. And once you are
doing that, it will be better to add a test case to check the error message
also.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services