herunkang2018 commented on code in PR #3330:
URL: https://github.com/apache/calcite/pull/3330#discussion_r1278477675


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -4320,6 +4320,23 @@ static void checkRlikeFails(SqlOperatorFixture f) {
     f0.forEachLibrary(list(SqlLibrary.BIG_QUERY, SqlLibrary.MYSQL), consumer);
   }
 
+  @Test void testLevenshtein() {
+    final SqlOperatorFixture f0 = 
fixture().setFor(SqlLibraryOperators.LEVENSHTEIN);
+    f0.checkFails("^levenshtein('abc', 'abc')^",
+        "No match found for function signature LEVENSHTEIN\\(<CHARACTER>, 
<CHARACTER>\\)",
+        false);
+    final Consumer<SqlOperatorFixture> consumer = f -> {
+      f.checkScalar("levenshtein('', '')", 0, "INTEGER NOT NULL");
+      f.checkScalar("levenshtein('abc', 'abc')", 0, "INTEGER NOT NULL");
+      f.checkScalar("levenshtein('kitten', 'sitting')", 3, "INTEGER NOT NULL");
+      f.checkScalar("levenshtein('frog', 'fog')", 1, "INTEGER NOT NULL");
+      f.checkScalar("levenshtein(_UTF8'\u4F60\u597D', 
_UTF8'\u4F60\u5F88\u597D')",
+          1, "INTEGER NOT NULL");

Review Comment:
   It will return null, I will add a test case for it.



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