doc-exports/docs/dli/sqlreference/dli_spark_levenshtein.html
Su, Xiaomeng 76a5b1ee83 dli_sqlreference_20240227
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2024-03-27 22:02:33 +00:00

4.2 KiB

levenshtein

This function is used to returns the Levenshtein distance between two strings, for example, levenshtein('kitten','sitting') = 3.

Levenshtein distance is a type of edit distance. It indicates the minimum number of edit operations required to convert one string into another.

Syntax

levenshtein(string A, string B)

Parameters

Table 1 Parameter

Parameter

Mandatory

Type

Description

A, B

Yes

STRING

String to be entered for calculating the Levenshtein distance

Return Values

The return value is of the INT type.

Example Code

The value 3 is returned.

SELECT levenshtein('kitten','sitting');