hsyuan commented on a change in pull request #1140: [CALCITE-2965] Implement 
string functions: REPEAT, SPACE, SOUNDEX, DI…
URL: https://github.com/apache/calcite/pull/1140#discussion_r271460662
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
 ##########
 @@ -243,6 +250,36 @@ public static int ascii(String s) {
         ? 0 : s.codePointAt(0);
   }
 
+  /** SQL REPEAT(string, int) function. */
+  public static String repeat(String s, int n) {
+    if (n < 1) {
+      return "";
+    }
+    return Strings.repeat(s, n);
+  }
+
+  /** SQL SPACE(int) function. */
+  public static String space(int n) {
+    return repeat(" ", n);
+  }
+
+  /** SQL SOUNDEX(STRING) function. */
+  public static String soundex(String s) {
+    return SOUNDEX.soundex(s);
+  }
+
+  /** SQL DIFFERENCE(STRING, STRING) function. */
 
 Review comment:
   string in lower case.

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