chunweilei commented on a change in pull request #1095: [CALCITE-2599] add the 
ASCII function
URL: https://github.com/apache/calcite/pull/1095#discussion_r264001113
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
 ##########
 @@ -237,6 +238,12 @@ public static String initcap(String s) {
     return newS.toString();
   }
 
+  /** SQL ASCII(string) function. */
+  public static int ascii(String s) {
+    return s.length() == 0
+        ? 0 : s.substring(0, 1).getBytes(StandardCharsets.UTF_8)[0];
 
 Review comment:
   Substring returns a string which has getBytes function and it can specify 
charset.  

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to