Skip to content

Commit

Permalink
[VL] Enable levenshtein function (#6389)
Browse files Browse the repository at this point in the history
[VL] Enable levenshtein function.
  • Loading branch information
zhli1142015 authored Jul 10, 2024
1 parent 7467fe4 commit 5bd7e3f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion docs/velox-backend-support-progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | | | | | | | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 5bd7e3f

Please sign in to comment.