This is an automated email from the ASF dual-hosted git repository. luzhijing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 89e0d03a170 [Fix](function) fix pad functions behaviour of empty pad string (#647) 89e0d03a170 is described below commit 89e0d03a170e5439927bdfd96101bd778bd162e7 Author: zclllyybb <zhaochan...@selectdb.com> AuthorDate: Thu May 16 07:53:12 2024 +0800 [Fix](function) fix pad functions behaviour of empty pad string (#647) --- docs/sql-manual/sql-functions/string-functions/lpad.md | 10 ++++++++++ docs/sql-manual/sql-functions/string-functions/rpad.md | 10 ++++++++++ .../current/sql-manual/sql-functions/string-functions/lpad.md | 10 ++++++++++ .../current/sql-manual/sql-functions/string-functions/rpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/lpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/rpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/lpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/rpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/lpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/rpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/lpad.md | 10 ++++++++++ .../sql-manual/sql-functions/string-functions/rpad.md | 10 ++++++++++ 12 files changed, 120 insertions(+) diff --git a/docs/sql-manual/sql-functions/string-functions/lpad.md b/docs/sql-manual/sql-functions/string-functions/lpad.md index 5e2d9b95536..0a94045f771 100644 --- a/docs/sql-manual/sql-functions/string-functions/lpad.md +++ b/docs/sql-manual/sql-functions/string-functions/lpad.md @@ -33,6 +33,8 @@ under the License. Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length. The len is character length not the bye size. +Except when it contains a NULL in parameters, when pad's length is 0, the return value is the empty string. + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT lpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT lpad("", 0, ""); ++-----------------+ +| lpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords LPAD diff --git a/docs/sql-manual/sql-functions/string-functions/rpad.md b/docs/sql-manual/sql-functions/string-functions/rpad.md index f5ffb5bae4d..445e0a86a19 100644 --- a/docs/sql-manual/sql-functions/string-functions/rpad.md +++ b/docs/sql-manual/sql-functions/string-functions/rpad.md @@ -33,6 +33,8 @@ under the License. Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to the right of STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length. The len is character length not the bye size. +Except when it contains a NULL in parameters, when pad's length is 0, the return value is the empty string. + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT rpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT rpad("", 0, ""); ++-----------------+ +| rpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords RPAD diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/lpad.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/lpad.md index 631ee8406c6..598baede019 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/lpad.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/lpad.md @@ -33,6 +33,8 @@ under the License. 返回 str 中长度为 len(从首字母开始算起)的字符串。如果 len 大于 str 的长度,则在 str 的前面不断补充 pad 字符,直到该字符串的长度达到 len 为止。如果 len 小于 str 的长度,该函数相当于截断 str 字符串,只返回长度为 len 的字符串。len 指的是字符长度而不是字节长度。 +除包含 NULL 值外,如果 pad 为空,则返回值为空串。 + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT lpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT lpad("", 0, ""); ++-----------------+ +| lpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords LPAD diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/rpad.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/rpad.md index 3e64a0b76c4..25d2d54269d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/rpad.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/rpad.md @@ -33,6 +33,8 @@ under the License. 返回 str 中长度为 len(从首字母开始算起)的字符串。如果 len 大于 str 的长度,则在 str 的后面不断补充 pad 字符,直到该字符串的长度达到 len 为止。如果 len 小于 str 的长度,该函数相当于截断 str 字符串,只返回长度为 len 的字符串。len 指的是字符长度而不是字节长度。 +除包含 NULL 值外,如果 pad 为空,则返回值为空串。 + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT rpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT rpad("", 0, ""); ++-----------------+ +| rpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords RPAD diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md index 631ee8406c6..598baede019 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md @@ -33,6 +33,8 @@ under the License. 返回 str 中长度为 len(从首字母开始算起)的字符串。如果 len 大于 str 的长度,则在 str 的前面不断补充 pad 字符,直到该字符串的长度达到 len 为止。如果 len 小于 str 的长度,该函数相当于截断 str 字符串,只返回长度为 len 的字符串。len 指的是字符长度而不是字节长度。 +除包含 NULL 值外,如果 pad 为空,则返回值为空串。 + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT lpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT lpad("", 0, ""); ++-----------------+ +| lpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords LPAD diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md index 3e64a0b76c4..25d2d54269d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md @@ -33,6 +33,8 @@ under the License. 返回 str 中长度为 len(从首字母开始算起)的字符串。如果 len 大于 str 的长度,则在 str 的后面不断补充 pad 字符,直到该字符串的长度达到 len 为止。如果 len 小于 str 的长度,该函数相当于截断 str 字符串,只返回长度为 len 的字符串。len 指的是字符长度而不是字节长度。 +除包含 NULL 值外,如果 pad 为空,则返回值为空串。 + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT rpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT rpad("", 0, ""); ++-----------------+ +| rpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords RPAD diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md index 631ee8406c6..598baede019 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md @@ -33,6 +33,8 @@ under the License. 返回 str 中长度为 len(从首字母开始算起)的字符串。如果 len 大于 str 的长度,则在 str 的前面不断补充 pad 字符,直到该字符串的长度达到 len 为止。如果 len 小于 str 的长度,该函数相当于截断 str 字符串,只返回长度为 len 的字符串。len 指的是字符长度而不是字节长度。 +除包含 NULL 值外,如果 pad 为空,则返回值为空串。 + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT lpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT lpad("", 0, ""); ++-----------------+ +| lpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords LPAD diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md index 3e64a0b76c4..25d2d54269d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md @@ -33,6 +33,8 @@ under the License. 返回 str 中长度为 len(从首字母开始算起)的字符串。如果 len 大于 str 的长度,则在 str 的后面不断补充 pad 字符,直到该字符串的长度达到 len 为止。如果 len 小于 str 的长度,该函数相当于截断 str 字符串,只返回长度为 len 的字符串。len 指的是字符长度而不是字节长度。 +除包含 NULL 值外,如果 pad 为空,则返回值为空串。 + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT rpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT rpad("", 0, ""); ++-----------------+ +| rpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords RPAD diff --git a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md index 5e2d9b95536..0a94045f771 100644 --- a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md +++ b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/lpad.md @@ -33,6 +33,8 @@ under the License. Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length. The len is character length not the bye size. +Except when it contains a NULL in parameters, when pad's length is 0, the return value is the empty string. + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT lpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT lpad("", 0, ""); ++-----------------+ +| lpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords LPAD diff --git a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md index f5ffb5bae4d..445e0a86a19 100644 --- a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md +++ b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/rpad.md @@ -33,6 +33,8 @@ under the License. Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to the right of STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length. The len is character length not the bye size. +Except when it contains a NULL in parameters, when pad's length is 0, the return value is the empty string. + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT rpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT rpad("", 0, ""); ++-----------------+ +| rpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords RPAD diff --git a/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md b/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md index 5e2d9b95536..0a94045f771 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md +++ b/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/lpad.md @@ -33,6 +33,8 @@ under the License. Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length. The len is character length not the bye size. +Except when it contains a NULL in parameters, when pad's length is 0, the return value is the empty string. + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT lpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT lpad("", 0, ""); ++-----------------+ +| lpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords LPAD diff --git a/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md b/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md index f5ffb5bae4d..445e0a86a19 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md +++ b/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/rpad.md @@ -33,6 +33,8 @@ under the License. Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to the right of STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length. The len is character length not the bye size. +Except when it contains a NULL in parameters, when pad's length is 0, the return value is the empty string. + ### example ``` @@ -49,6 +51,14 @@ mysql> SELECT rpad("hi", 1, "xy"); +---------------------+ | h | +---------------------+ + +mysql> SELECT rpad("", 0, ""); ++-----------------+ +| rpad('', 0, '') | ++-----------------+ +| | ++-----------------+ ``` + ### keywords RPAD --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org