ILuffZhe commented on code in PR #4176:
URL: https://github.com/apache/calcite/pull/4176#discussion_r1938387850


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -330,6 +330,28 @@ private static String toBase64_(byte[] bytes) {
     }
   }
 
+  /** SQL BASE64(string) function for string. */
+  public static String base64(String string) {
+    return toBase64_(string.getBytes(UTF_8));
+  }
+
+  /** SQL BASE64(string) function for bytestring. */
+  public static String base64(ByteString byteString) {
+    byte[] bytes = byteString.getBytes();
+    return toBase64_(bytes);
+  }
+
+  /** SQL UNBASE64(string) function. */
+  public static @Nullable String unBase64(String base64) {

Review Comment:
   Can we make it return ByteString, so `ByteString fromBase64(String base64)` 
can be used.



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

Reply via email to