Jackie-Jiang commented on a change in pull request #8378: URL: https://github.com/apache/pinot/pull/8378#discussion_r832494999
########## File path: pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java ########## @@ -443,4 +446,28 @@ public static boolean contains(String input, String substring) { public static int strcmp(String input1, String input2) { return input1.compareTo(input2); } + + /** + * + * @param input plaintext string + * @return url encoded string + * @throws UnsupportedEncodingException + */ + @ScalarFunction + public static String encodeUrl(String input) + throws UnsupportedEncodingException { + return URLEncoder.encode(input, StandardCharsets.UTF_8.toString()); Review comment: ```suggestion return URLEncoder.encode(input, StandardCharsets.UTF_8); ``` ########## File path: pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java ########## @@ -443,4 +446,28 @@ public static boolean contains(String input, String substring) { public static int strcmp(String input1, String input2) { return input1.compareTo(input2); } + + /** + * + * @param input plaintext string + * @return url encoded string + * @throws UnsupportedEncodingException + */ + @ScalarFunction + public static String encodeUrl(String input) + throws UnsupportedEncodingException { + return URLEncoder.encode(input, StandardCharsets.UTF_8.toString()); + } + + /** + * + * @param input url encoded string + * @return plaintext string + * @throws UnsupportedEncodingException + */ + @ScalarFunction + public static String decodeUrl(String input) + throws UnsupportedEncodingException { + return URLDecoder.decode(input, StandardCharsets.UTF_8.toString()); Review comment: ```suggestion return URLDecoder.decode(input, StandardCharsets.UTF_8); ``` -- 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