satishd commented on code in PR #12603:
URL: https://github.com/apache/pinot/pull/12603#discussion_r1521590592


##########
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 we return null itself, as 
null can be treated as valid json

Review Comment:
   This statement does not seem to be aligned with what is implemented and 
merged here. If the argument is null, it returns false as 
`JsonUtils.stringToJsonNode(inputStr);` throws an Exception.
   
   The discussion in the comment 
[thread](https://github.com/apache/pinot/pull/12603#discussion_r1518149953) is 
also confusing to what is finally added here. It is good to add the conclusion 
in that thread for readers if it is decided based on offline discussion. 
    



##########
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 we return null itself, as 
null can be treated as valid json
+   * in partial-upsert scenarios. Upto the user to use null response 
accordingly.
+   *
+   * @param inputStr Input string to test for valid json
+   * @return in case of null value, it returns null. In case of non-null, it 
returns true in case of valid json

Review Comment:
   Same comment as earlier for a null argument.



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