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/07/28 21:42:34 UTC

[GitHub] [pinot] SabrinaZhaozyf commented on a diff in pull request #9114: Added Base64 Encoding/Decoding Scalar Functions

SabrinaZhaozyf commented on code in PR #9114:
URL: https://github.com/apache/pinot/pull/9114#discussion_r932702975


##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/StringFunctions.java:
##########
@@ -560,4 +561,24 @@ public static String decodeUrl(String input)
       throws UnsupportedEncodingException {
     return URLDecoder.decode(input, StandardCharsets.UTF_8.toString());
   }
+
+  /**
+   * @param input utf-8 encoded String
+   * @return Base64 encoded String
+   */
+  @ScalarFunction
+  public static String toBase64(String input) {

Review Comment:
   Hi Jackie, thanks for the input!
   I decided to set the argument type to String as that follows [MySql’s syntax](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_to-base64) and will give better usability.
   `TO_BASE64(str)` will use default JVM encoding.
   
   However, I do understand where you are coming from and there are 2 things that I want to propose for better flexibility.
   `TO_BASE64(str, encodingscheme)` will use user-specified encoding scheme.
   `BINARY_TO_BASE64(byte[])` directly encodes binary to Base64.
   
   Please let me know what you think!



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