snuyanzin commented on code in PR #3590:
URL: https://github.com/apache/calcite/pull/3590#discussion_r1435295636


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -8897,56 +8898,44 @@ private void testCurrentDateFunc(Pair<String, 
Hook.Closeable> pair) {
     f0.forEachLibrary(list(SqlLibrary.BIG_QUERY, SqlLibrary.ORACLE), consumer);
   }
 
-  @Test void testStartsWithFunction() {
+  /** Tests the {@code STARTS_WITH} and {@code STARTSWITH} operator. */
+  @ParameterizedTest(name = "{0}")
+  @MethodSource("startsWithAliases")
+  void testStartsWithFunction2(FunctionAlias functionAlias) {
     final SqlOperatorFixture f0 = fixture();
-    f0.setFor(SqlLibraryOperators.STARTS_WITH);
+    final SqlFunction function = functionAlias.function;
+    f0.setFor(function);
+    final String alias = functionAlias.alias;
     final Consumer<SqlOperatorFixture> consumer = f -> {
-      f.checkBoolean("starts_with('12345', '123')", true);
-      f.checkBoolean("starts_with('12345', '1243')", false);
-      f.checkBoolean("starts_with(x'11', x'11')", true);
-      f.checkBoolean("starts_with(x'112211', x'33')", false);
-      f.checkFails("^starts_with('aabbcc', x'aa')^",
-          "Cannot apply 'STARTS_WITH' to arguments of type "
-              + "'STARTS_WITH\\(<CHAR\\(6\\)>, <BINARY\\(1\\)>\\)'\\. 
Supported "
-              + "form\\(s\\): 'STARTS_WITH\\(<STRING>, <STRING>\\)'",
+      f.checkBoolean(alias + "('12345', '123')", true);

Review Comment:
   i put it in a separate commit here to see how it could look like
   
https://github.com/apache/calcite/pull/3590/commits/88fc66326964d1019de37b9b924445ac5648ad6e



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