Jackie-Jiang commented on code in PR #16910:
URL: https://github.com/apache/pinot/pull/16910#discussion_r2383254301
##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java:
##########
@@ -586,6 +648,21 @@ public Iterable<?> toIterable(Object obj) {
}
}
+ private static boolean jsonPathBoolean(@Nullable Object object, String
jsonPath, boolean defaultValue) {
Review Comment:
We can also make this a scalar function
##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java:
##########
@@ -323,6 +351,40 @@ public static Object jsonStringToListOrMap(String
jsonString) {
return null;
}
+ @ScalarFunction
+ public static Object jsonExtractScalar(Object jsonInput, String jsonPath,
String dataType) {
+ return jsonExtractScalar(jsonInput, jsonPath, dataType, null);
+ }
+
+ @ScalarFunction
+ public static Object jsonExtractScalar(Object jsonInput, String jsonPath,
String dataType, Object defaultValue) {
+ try {
+ switch (dataType.toUpperCase()) {
Review Comment:
Several data types are not supported. Could you please make sure all types
supported in `JsonExtractScalarTransformFunction` are also supported here?
##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/JsonFunctions.java:
##########
@@ -210,6 +211,33 @@ public static long jsonPathLong(@Nullable Object object,
String jsonPath, long d
}
}
+ /**
+ * Extract from Json with path to Int
+ */
+ @ScalarFunction
+ public static long jsonPathInt(Object object, String jsonPath) {
Review Comment:
This method should return `int`
--
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]