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


##########
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:
   Thanks for the followup! After considering both you and @siddharthteotia 's 
comments, I propose the following approach. Please let me know what you think.
   
   TO_BASE64:  byte[] -> base64 encoding ----> String
   FROM_BASE64: String ---> base64 decoding -> byte[]
   
   If user wants to encode a string using base 64, they can do 
to_base64(to_utf8("hello!"))
   If user wants to decode a string using base 64, they can do 
from_utf8(from_base64("schcdeicei"))
   They can also use other String encode/decode scheme, and Pinot currently 
supports ASCII and UTF8.
   
   cc: @siddharthteotia @jasperjiaguo 



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

Reply via email to