Hi :wink: Quick question about interest about a PR...
# pinot-dev
f
Hi 😉 Quick question about interest about a PR or not , and if not a way to easly integrate my changes with future master build. I’ve modified tranformFunction JsonPathString(Object,String,String) from
Copy code
@ScalarFunction(nullableParameters = true)
public static String jsonPathString(@Nullable Object object, String jsonPath, String defaultValue) {
  try {
    Object jsonValue = jsonPath(object, jsonPath);
    if (jsonValue instanceof String) {
      return (String) jsonValue;
    }
    return jsonValue == null ? defaultValue : JsonUtils.objectToString(jsonValue);
  } catch (Exception ignore) {
    return defaultValue;
  }
}
to
Copy code
@ScalarFunction(nullableParameters = true)
public static String jsonPathString(@Nullable Object object, String jsonPath, String defaultValue) {
  try {
    Object jsonValue = jsonPath(object, jsonPath);
    if ((jsonValue instanceof String) && (!String.valueOf(jsonValue).isBlank())) {
      return (String) jsonValue;
    }
    return jsonValue == null || String.valueOf(jsonValue).isBlank()
        ? defaultValue : JsonUtils.objectToString(jsonValue);
  } catch (Exception ignore) {
    return defaultValue;
  }
}
Doing that allow me to set a default value on the blank string also. Thats can be helpfull on many use cases. Is that interesting to get that as a PR ? If not do I have a way to surcharge this with a provided jar or something easy to integrate ?
I answer my own question after a bit of time ... using https://medium.com/apache-pinot-developer-blog/utilize-udfs-to-supercharge-queries-in-apache-pinot-e488a0f164f1 it’s possible. Il will just have to declare a function with a different name and put it in a plugin.