This is an automated email from the ASF dual-hosted git repository. tarmstrong pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 781cb915e5bfc01c3fb198cbf195d67f01b90aa1 Author: Alex Rodoni <arod...@cloudera.com> AuthorDate: Mon Feb 4 15:48:10 2019 -0800 IMPALA-7920: [DOCS] Document the LEVENSHTEIN function Change-Id: Iefeb38871f14c87f8cce7feb9197ab0e79429d04 Reviewed-on: http://gerrit.cloudera.org:8080/12357 Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Reviewed-by: Greg Rahn <gr...@cloudera.com> --- docs/topics/impala_string_functions.xml | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/docs/topics/impala_string_functions.xml b/docs/topics/impala_string_functions.xml index a32dbf7..356f700 100644 --- a/docs/topics/impala_string_functions.xml +++ b/docs/topics/impala_string_functions.xml @@ -135,6 +135,10 @@ under the License. </li> <li> + <xref href="#string_functions/levenshtein">LEVENSHTEIN, LE_DST</xref> + </li> + + <li> <xref href="#string_functions/locate">LOCATE</xref> </li> @@ -767,7 +771,58 @@ select instr('foo bar bletch', 'b', 1, null); </dd> </dlentry> + </dl> + + <dl> + <dlentry id="levenshtein" rev="3.2"> + + <dt> + LEVENSHTEIN(STRING str1, STRING str2), <ph id="le_dst" + >LE_DST(STRING + str1, STRING str2)</ph> + </dt> + + <dd> + <b>Purpose:</b> Returns the Levenshtein distance between two input strings. The + Levenshtein distance between two strings is the minimum number of single-character + edits required to transform one string to other. The function indicates how different + the input strings are. + <p> + <b>Return type:</b> <codeph>INT</codeph> + </p> + <b>Usage notes:</b> + <p> + If input strings are equal, the function returns 0. + </p> + + <p> + If either input exceeds 255 characters, the function returns an error. + </p> + + <p> + If either input string is <codeph>NULL</codeph>, the function returns + <codeph>NULL</codeph>. + </p> + + <p> + If the length of one input string is zero, the function returns the length of the + other string. + </p> + + <p> + <b>Example:</b> + </p> + <p> + <codeph>LEVENSHTEIN ('welcome', 'We come')</codeph> returns 2, first change to + replace '<codeph>w</codeph>' to '<codeph>W</codeph>', and then to replace + '<codeph>l</codeph>' to a space character. + </p> + </dd> + + </dlentry> + </dl> + <dl> <dlentry id="locate"> <dt>