You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/03/22 18:39:10 UTC

[GitHub] [pinot] jasperjiaguo commented on a change in pull request #8378: Scalar function for url encoding and decoding

jasperjiaguo commented on a change in pull request #8378:
URL: https://github.com/apache/pinot/pull/8378#discussion_r832506905



##########
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:
       The java8 compilation will fail if we don't add `.toString()` 
   https://github.com/apache/pinot/runs/5632328340?check_suite_focus=true




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org