This is an automated email from the ASF dual-hosted git repository.

morningman 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 828102a2a20 [fix](doc) v2.1: fix APPEND_TRAILING_CHAR_IF_ABSENT 
examples (EN+ZH) (#3858)
828102a2a20 is described below

commit 828102a2a20fe3459e8cdcfff6f76962b67e6966
Author: boluor <[email protected]>
AuthorDate: Fri May 29 20:00:22 2026 -0700

    [fix](doc) v2.1: fix APPEND_TRAILING_CHAR_IF_ABSENT examples (EN+ZH) (#3858)
    
    Backport of #3855 to `version-2.1`.
    
    ## Problem
    
    On v2.1 **both** the EN and ZH pages keep the old combined example whose
    third call, `APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'cd')`, is documented
    as returning `accd`. That is wrong: `<trailing_char>` is a **single**
    trailing character, and passing a 2-character string returns `NULL`.
    
    (On v3.x only ZH needed this — EN had already been rewritten. On v2.1
    neither language was rewritten, so this PR fixes both.)
    
    ## Fix
    
    Replace the combined example with five focused single-character
    examples, matching the corrected v3.x EN page.
    
    ## Cluster verification (Doris 2.1.11-rc01)
    
    ```
    SELECT APPEND_TRAILING_CHAR_IF_ABSENT('a', 'c');    -> ac
    SELECT APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'c');   -> ac
    SELECT APPEND_TRAILING_CHAR_IF_ABSENT('', '/');     -> /
    SELECT APPEND_TRAILING_CHAR_IF_ABSENT(NULL, 'c');   -> NULL
    SELECT APPEND_TRAILING_CHAR_IF_ABSENT('acf', 'ṛ');  -> acfṛ
    
    -- and confirming the removed case is wrong:
    SELECT APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'cd');  -> NULL   (doc 
previously said 'accd')
    ```
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
---
 .../append-trailing-char-if-absent.md              | 64 +++++++++++++++++++---
 .../append-trailing-char-if-absent.md              | 64 +++++++++++++++++++---
 2 files changed, 112 insertions(+), 16 deletions(-)

diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
index 4dcf3c2f88f..73d339b4cb2 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
@@ -29,14 +29,62 @@ APPEND_TRAILING_CHAR_IF_ABSENT ( <str> , <trailing_char> )
 
 ## 举例
 
-``` sql
-SELECT 
APPEND_TRAILING_CHAR_IF_ABSENT('a','c'),APPEND_TRAILING_CHAR_IF_ABSENT('ac', 
'c'),APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'cd')
+1. 基本用法:结尾字符不存在时进行添加
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('a', 'c');
+```
+```text
++------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('a', 'c') |
++------------------------------------------+
+| ac                                       |
++------------------------------------------+
+```
+
+2. 结尾字符已存在,不重复添加
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'c');
+```
+```text
++-------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'c') |
++-------------------------------------------+
+| ac                                        |
++-------------------------------------------+
+```
+
+3. 空字符串处理
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('', '/');
+```
+```text
++-----------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('', '/') |
++-----------------------------------------+
+| /                                       |
++-----------------------------------------+
+```
+
+4. NULL 值处理
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT(NULL, 'c');
+```
+```text
++-------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT(NULL, 'c') |
++-------------------------------------------+
+| NULL                                      |
++-------------------------------------------+
 ```
 
-```text 
-+------------------------------------------+-------------------------------------------+--------------------------------------------+
-| append_trailing_char_if_absent('a', 'c') | 
append_trailing_char_if_absent('ac', 'c') | 
append_trailing_char_if_absent('ac', 'cd') |
-+------------------------------------------+-------------------------------------------+--------------------------------------------+
-| ac                                       | ac                                
        | accd                                       |
-+------------------------------------------+-------------------------------------------+--------------------------------------------+
+5. UTF-8 字符
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('acf', 'ṛ');
+```
+```text
++----------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('acf', 'ṛ')   |
++----------------------------------------------+
+| acfṛ                                         |
++----------------------------------------------+
 ```
diff --git 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
index 4380cb61be4..aa45540c7f3 100644
--- 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
+++ 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/append-trailing-char-if-absent.md
@@ -29,14 +29,62 @@ Parameters The string after concatenation of `<str>` and 
`<trailing_char>` (if `
 
 ## Example
 
-``` sql
-SELECT 
APPEND_TRAILING_CHAR_IF_ABSENT('a','c'),APPEND_TRAILING_CHAR_IF_ABSENT('ac', 
'c'),APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'cd')
+1. Basic usage: Add character when it doesn't exist
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('a', 'c');
+```
+```text
++------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('a', 'c') |
++------------------------------------------+
+| ac                                       |
++------------------------------------------+
+```
+
+2. Character already exists, don't add
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'c');
+```
+```text
++-------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('ac', 'c') |
++-------------------------------------------+
+| ac                                        |
++-------------------------------------------+
+```
+
+3. Empty string handling
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('', '/');
+```
+```text
++-----------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('', '/') |
++-----------------------------------------+
+| /                                       |
++-----------------------------------------+
+```
+
+4. NULL value handling
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT(NULL, 'c');
+```
+```text
++-------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT(NULL, 'c') |
++-------------------------------------------+
+| NULL                                      |
++-------------------------------------------+
 ```
 
-```text 
-+------------------------------------------+-------------------------------------------+--------------------------------------------+
-| append_trailing_char_if_absent('a', 'c') | 
append_trailing_char_if_absent('ac', 'c') | 
append_trailing_char_if_absent('ac', 'cd') |
-+------------------------------------------+-------------------------------------------+--------------------------------------------+
-| ac                                       | ac                                
        | accd                                       |
-+------------------------------------------+-------------------------------------------+--------------------------------------------+
+5. UTF-8 character
+```sql
+SELECT APPEND_TRAILING_CHAR_IF_ABSENT('acf', 'ṛ');
+```
+```text
++----------------------------------------------+
+| APPEND_TRAILING_CHAR_IF_ABSENT('acf', 'ṛ')   |
++----------------------------------------------+
+| acfṛ                                         |
++----------------------------------------------+
 ```


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to