richardstartin commented on a change in pull request #7819: URL: https://github.com/apache/pinot/pull/7819#discussion_r755082361
########## File path: pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java ########## @@ -149,50 +159,45 @@ public static String jsonPathString(Object object, String jsonPath, String defau */ @ScalarFunction public static long jsonPathLong(Object object, String jsonPath) { - final Object jsonValue = jsonPath(object, jsonPath); - if (jsonValue == null) { - return Long.MIN_VALUE; - } - if (jsonValue instanceof Number) { - return ((Number) jsonValue).longValue(); - } - return Long.parseLong(jsonValue.toString()); + return jsonPathLong(object, jsonPath, Long.MIN_VALUE); } /** * Extract from Json with path to Long */ @ScalarFunction public static long jsonPathLong(Object object, String jsonPath, long defaultValue) { - try { - return jsonPathLong(object, jsonPath); - } catch (Exception e) { + final Object jsonValue = jsonPath(object, jsonPath); + if (jsonValue == null) { return defaultValue; } + if (jsonValue instanceof Number) { + return ((Number) jsonValue).longValue(); + } + return Long.parseLong(jsonValue.toString()); } /** * Extract from Json with path to Double */ @ScalarFunction public static double jsonPathDouble(Object object, String jsonPath) { - final Object jsonValue = jsonPath(object, jsonPath); - if (jsonValue instanceof Number) { - return ((Number) jsonValue).doubleValue(); - } - return Double.parseDouble(jsonValue.toString()); + return jsonPathDouble(object, jsonPath, Double.NaN); Review comment: this is a behaviour change - it used to throw on missing paths (which I believe was unintended) and now returns `NaN` -- 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