This is an automated email from the ASF dual-hosted git repository.

zhli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 5bd7e3f7e [VL] Enable levenshtein function (#6389)
5bd7e3f7e is described below

commit 5bd7e3f7e1914c8198313ea95e4cd346d36f6a88
Author: Zhen Li <[email protected]>
AuthorDate: Wed Jul 10 19:00:16 2024 +0800

    [VL] Enable levenshtein function (#6389)
    
    [VL] Enable levenshtein function.
---
 .../gluten/execution/ScalarFunctionsValidateSuite.scala      | 12 ++++++++++++
 .../scalar_function_parser/CommonScalarFunctionParser.cpp    |  2 +-
 docs/velox-backend-support-progress.md                       |  2 +-
 .../scala/org/apache/gluten/expression/ExpressionNames.scala |  2 +-
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
 
b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
index 9d0a926e3..c8da6f79c 100644
--- 
a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
+++ 
b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala
@@ -1189,4 +1189,16 @@ class ScalarFunctionsValidateSuite extends 
FunctionsValidateTest {
         }
     }
   }
+
+  test("levenshtein") {
+    runQueryAndCompare("select levenshtein(c_comment, c_address) from customer 
limit 50") {
+      checkGlutenOperatorMatch[ProjectExecTransformer]
+    }
+  }
+
+  testWithSpecifiedSparkVersion("levenshtein with limit", Some("3.5")) {
+    runQueryAndCompare("select levenshtein(c_comment, c_address, 3) from 
customer limit 50") {
+      checkGlutenOperatorMatch[ProjectExecTransformer]
+    }
+  }
 }
diff --git 
a/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp
 
b/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp
index ca90b0bdb..e4855b507 100644
--- 
a/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp
+++ 
b/cpp-ch/local-engine/Parser/scalar_function_parser/CommonScalarFunctionParser.cpp
@@ -129,7 +129,7 @@ REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Translate, 
translate, translateUTF8);
 REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Initcap, initcap, initcapUTF8);
 REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Conv, conv, sparkConv);
 REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Uuid, uuid, generateUUIDv4);
-REGISTER_COMMON_SCALAR_FUNCTION_PARSER(LevenshteinDistance, 
levenshteinDistance, editDistanceUTF8);
+REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Levenshtein, levenshtein, 
editDistanceUTF8);
 
 REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Crc32, crc32, CRC32);
 REGISTER_COMMON_SCALAR_FUNCTION_PARSER(Murmur3Hash, murmur3hash, 
sparkMurmurHash3_32);
diff --git a/docs/velox-backend-support-progress.md 
b/docs/velox-backend-support-progress.md
index f3f1e100b..5a2d53376 100644
--- a/docs/velox-backend-support-progress.md
+++ b/docs/velox-backend-support-progress.md
@@ -161,7 +161,7 @@ Gluten supports 199 functions. (Drag to right to see all 
data types)
 | lcase, lower                  | lower                  | lower               
  | S      |                          |         |      |       |     |      |   
    |        |      |           | S      |         |      |        |          | 
      |     |        |     |
 | left                          |                        |                     
  | S      |                          |         |      |       |     |      |   
    |        |      |           | S      |         |      |        |          | 
      |     |        |     |
 | length                        | length                 | length              
  | S      |                          |         |      |       |     |      |   
    |        |      |           | S      |         |      |        |          | 
      |     |        |     |
-| levenshtein                   |                        |                     
  |        |                          |         |      |       |     |      |   
    |        |      |           |        |         |      |        |          | 
      |     |        |     |
+| levenshtein                   |                        | levenshtein         
             | S       |                          |         |      |       |    
 |      |       |        |      |           |        |         |      |        
|          |       |     |        |     |
 | locate                        | strpos                 |                     
  | S      | Mismatched               |         |      |       |     |      |   
    |        |      |           | S      |         |      |        |          | 
      |     |        |     |
 | lower                         | lower                  | lower               
  | S      |                          |         |      |       |     |      |   
    |        |      |           | S      |         |      |        |          | 
      |     |        |     |
 | lpad                          | lpad                   |                     
  | S      |                          |         |      |       |     |      |   
    |        |      |           | S      |         |      |        |          | 
      |     |        |     |
diff --git 
a/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
 
b/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
index e3dc3a8ab..0b31ec346 100644
--- 
a/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
+++ 
b/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
@@ -128,7 +128,7 @@ object ExpressionNames {
   final val UUID = "uuid"
   final val BIT_LENGTH = "bit_length"
   final val OCTET_LENGTH = "octet_length"
-  final val LEVENSHTEIN = "levenshteinDistance"
+  final val LEVENSHTEIN = "levenshtein"
   final val UNBASE64 = "unbase64"
   final val BASE64 = "base64"
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to