levenshtein function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns the Levenshtein distance between the strings str1 and str2.

Syntax

levenshtein(str1, str2)

Arguments

  • str1: A STRING expression.

  • str2: A STRING expression.

Returns

An INTEGER.

Examples

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