Jackie-Jiang commented on code in PR #12603:
URL: https://github.com/apache/pinot/pull/12603#discussion_r1520467627


##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java:
##########
@@ -831,4 +832,24 @@ public static boolean like(String inputStr, String 
likePatternStr) {
     String regexPatternStr = 
RegexpPatternConverterUtils.likeToRegexpLike(likePatternStr);
     return regexpLike(inputStr, regexPatternStr);
   }
+
+  /**
+   * Checks whether the input string can be parsed into a json node or not. 
Useful for scenarios where we want
+   * to filter out malformed json. In case of nulls, it is treated as valid 
json as in partial-upsert we might
+   * want to treat that column value as valid.
+   *
+   * @param inputStr Input string to test for valid json
+   */
+  @ScalarFunction
+  public static boolean isJson(String inputStr) {
+    try {
+      if (inputStr == null) {

Review Comment:
   If there is no `nullableParameters = true` in the annotation, it will return 
`null` whenever the argument is `null`. No need to explicitly return `null`



-- 
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]

Reply via email to