You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2018/08/03 21:23:31 UTC
[3/7] impala git commit: IMPALA-3330: [DOCS] TRANSLATE function
updated
IMPALA-3330: [DOCS] TRANSLATE function updated
- Better description
- Examples
Change-Id: Ica33ecbb7118e3034f95c5705eed19d169dc16cb
Reviewed-on: http://gerrit.cloudera.org:8080/11074
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-by: Jim Apple <jb...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/d0ec011b
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/d0ec011b
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/d0ec011b
Branch: refs/heads/master
Commit: d0ec011b3d50e968cf6c4074e15c0b887d962ab3
Parents: fb3d47d
Author: Alex Rodoni <ar...@cloudera.com>
Authored: Fri Jul 27 15:21:08 2018 -0700
Committer: Alex Rodoni <ar...@cloudera.com>
Committed: Thu Aug 2 22:18:05 2018 +0000
----------------------------------------------------------------------
docs/topics/impala_string_functions.xml | 34 +++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/d0ec011b/docs/topics/impala_string_functions.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_string_functions.xml b/docs/topics/impala_string_functions.xml
index 73fa236..ed5d028 100644
--- a/docs/topics/impala_string_functions.xml
+++ b/docs/topics/impala_string_functions.xml
@@ -1272,11 +1272,39 @@ select split_part('one\|/two\|/three','\|/',3);
</dt>
<dd>
- <indexterm audience="hidden">translate() function</indexterm>
- <b>Purpose:</b> Returns the input string with a set of characters replaced by another set of characters.
+ <b>Purpose:</b> Returns the <codeph>input</codeph> string with each
+ character in the <codeph>from</codeph> argument replaced with the
+ corresponding character in the <codeph>to</codeph> argument. The
+ characters are matched in the order they appear in
+ <codeph>from</codeph> and <codeph>to</codeph>. <p> For example:
+ <codeph>translate ('hello world','world','earth')</codeph> returns
+ <codeph>'hetta earth'</codeph>. </p>
<p>
- <b>Return type:</b> <codeph>string</codeph>
+ <b>Return type:</b>
+ <codeph>string</codeph>
</p>
+ <p>
+ <b>Usage notes:</b>
+ </p>
+ <p> If <codeph>from</codeph> contains more characters than
+ <codeph>to</codeph>, the <codeph>from</codeph> characters that are
+ beyond the length of <codeph>to</codeph> are removed in the result. </p>
+ <p> For example: </p>
+ <p>
+ <codeph>translate('abcdedg', 'bcd', '1')</codeph> returns
+ <codeph>'a1eg'</codeph>. </p>
+ <p><codeph>translate('Unit Number#2', '# ', '_')</codeph> returns
+ <codeph>'UnitNumber_2'</codeph>. </p>
+ <p> If <codeph>from</codeph> is <codeph>NULL</codeph>, the function
+ returns <codeph>NULL</codeph>. </p>
+ <p> If <codeph>to</codeph> contains more characters than
+ <codeph>from</codeph>, the extra characters in <codeph>to</codeph>
+ are ignored. </p>
+ <p> If <codeph>from</codeph> contains duplicate characters, the
+ duplicate character is replaced with the first matching character in
+ <codeph>to</codeph>. </p>
+ <p> For example: <codeph>translate ('hello','ll','67')</codeph>
+ returns <codeph>'he66o'</codeph>. </p>
</dd>
</dlentry>