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 0213476bfc8 [fix](doc) string-functions en: backport corner-case 
examples that exist on zh (6 pages) (#3815)
0213476bfc8 is described below

commit 0213476bfc82b715cfa4b90a65fdcccc73bd2897
Author: boluor <[email protected]>
AuthorDate: Wed May 27 19:16:29 2026 -0700

    [fix](doc) string-functions en: backport corner-case examples that exist on 
zh (6 pages) (#3815)
    
    ## Summary
    
    For six string-functions doc pages, the EN side has fewer examples than
    the ZH side. This PR ports the ZH-only corner-case examples to EN so
    both pages cover the same set of behaviors.
    
    | Page | Examples added to EN | Notes |
    |------|---------------------|-------|
    | \`hex.md\` | +4 | whitespace bytes, UTF-8 input, negative two's
    complement, mixed alphanum |
    | \`initcap.md\` | +6 | empty, non-alphanumeric separators, UTF-8 words,
    names, sentences, multi-space & adjacent punctuation |
    | \`lcase.md\` | +4 | empty, already-lowercase/numeric, non-alphabetic
    passthrough, UTF-8 case folding |
    | \`ltrim.md\` | +6 | empty inputs, multi-char substring strip, full
    match, UTF-8 substring strip, numeric, punctuation |
    | \`replace.md\` | +4 | empty-string edge cases, case-sensitivity,
    no-match, overlap-free repeats |
    | \`xpath-string.md\` | +4 (and renamed an existing mislabel) | NULL
    input rename, CDATA, comments stripped, no-match, malformed XML error |
    
    ## Notes
    - I deliberately skipped one ZH \`ltrim\` example that claimed \`LTRIM('
    \\\\t\\\\n hello world')\` returns \`hello world\` — on Apache Doris
    4.1.1 LTRIM only strips ASCII spaces, so the actual output starts with
    the literal tab. The example was passing the ZH verifier only because
    its result block contained a real newline that broke the ASCII-table
    parser. Not porting an example whose documented output is wrong.
    - The existing \`xpath-string.md\` example 5 was titled \"Handling CDATA
    and comments\" but its SQL was \`xpath_string(NULL, '/a')\` — a pure
    NULL test, no CDATA. Renamed it to \"NULL input\" and added the *actual*
    CDATA / comments / no-match / malformed-XML examples as 6-9.
    
    ## Verification
    
    Every added example was run against a single-node Apache Doris 4.1.1
    cluster; result blocks are the verbatim mysql client output (including
    column-width padding).
    
    ## Test plan
    
    - [x] All 28 added examples produce the documented result on 4.1.1.
    - [x] Skipped LTRIM \\t\\n example documented in PR body.
    - [x] xpath-string example 5 rename + 6-9 additions verified.
    - [x] No deletions of existing examples on any page.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
---
 .../scalar-functions/string-functions/hex.md       | 48 +++++++++++++++
 .../scalar-functions/string-functions/initcap.md   | 72 ++++++++++++++++++++++
 .../scalar-functions/string-functions/lcase.md     | 48 +++++++++++++++
 .../scalar-functions/string-functions/ltrim.md     | 72 ++++++++++++++++++++++
 .../scalar-functions/string-functions/replace.md   | 48 +++++++++++++++
 .../string-functions/xpath-string.md               | 44 ++++++++++++-
 6 files changed, 331 insertions(+), 1 deletion(-)

diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hex.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hex.md
index e3283d606f2..19363255a28 100644
--- 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hex.md
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/hex.md
@@ -101,4 +101,52 @@ SELECT HEX(0), HEX('');
 +--------+--------+
 | 0      |        |
 +--------+--------+
+```
+
+6. Whitespace characters (each byte → two hex digits)
+```sql
+SELECT HEX(' '), HEX('\t'), HEX('\n');
+```
+```text
++----------+-----------+-----------+
+| HEX(' ') | HEX('\t') | HEX('\n') |
++----------+-----------+-----------+
+| 20       | 09        | 0A        |
++----------+-----------+-----------+
+```
+
+7. UTF-8 multi-byte strings
+```sql
+SELECT HEX('ṭṛì'), HEX('ḍḍumai');
+```
+```text
++------------------+----------------------+
+| HEX('ṭṛì')       | HEX('ḍḍumai')        |
++------------------+----------------------+
+| E1B9ADE1B99BC3AC | E1B88DE1B88D756D6169 |
++------------------+----------------------+
+```
+
+8. Negative integers (64-bit two's complement)
+```sql
+SELECT HEX(-128), HEX(-32768);
+```
+```text
++------------------+------------------+
+| HEX(-128)        | HEX(-32768)      |
++------------------+------------------+
+| FFFFFFFFFFFFFF80 | FFFFFFFFFFFF8000 |
++------------------+------------------+
+```
+
+9. Mixed alphanumeric strings
+```sql
+SELECT HEX('A1'), HEX('Hello!');
+```
+```text
++-----------+---------------+
+| HEX('A1') | HEX('Hello!') |
++-----------+---------------+
+| 4131      | 48656C6C6F21  |
++-----------+---------------+
 ```
\ No newline at end of file
diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/initcap.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/initcap.md
index 53c287be053..76d26177700 100644
--- 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/initcap.md
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/initcap.md
@@ -87,4 +87,76 @@ SELECT INITCAP('hello hello.,HELLO123HELlo');
 +---------------------------------------+
 | Hello Hello.,Hello123hello            |
 +---------------------------------------+
+```
+
+5. Empty string
+```sql
+SELECT INITCAP('');
+```
+```text
++-------------+
+| INITCAP('') |
++-------------+
+|             |
++-------------+
+```
+
+6. Multiple non-alphanumeric separators
+```sql
+SELECT INITCAP('word1@word2#word3$word4');
+```
+```text
++------------------------------------+
+| INITCAP('word1@word2#word3$word4') |
++------------------------------------+
+| Word1@Word2#Word3$Word4            |
++------------------------------------+
+```
+
+7. UTF-8 multi-byte words
+```sql
+SELECT INITCAP('ṭṛì ḍḍumai hello');
+```
+```text
++--------------------------------------+
+| INITCAP('ṭṛì ḍḍumai hello')          |
++--------------------------------------+
+| Ṭṛì Ḍḍumai Hello                     |
++--------------------------------------+
+```
+
+8. Common name capitalization
+```sql
+SELECT INITCAP('john doe'), INITCAP('MARY JANE');
+```
+```text
++---------------------+----------------------+
+| INITCAP('john doe') | INITCAP('MARY JANE') |
++---------------------+----------------------+
+| John Doe            | Mary Jane            |
++---------------------+----------------------+
+```
+
+9. Sentences with mixed casing
+```sql
+SELECT INITCAP('the quick brown fox'), INITCAP('DATABASE management SYSTEM');
+```
+```text
++--------------------------------+---------------------------------------+
+| INITCAP('the quick brown fox') | INITCAP('DATABASE management SYSTEM') |
++--------------------------------+---------------------------------------+
+| The Quick Brown Fox            | Database Management System            |
++--------------------------------+---------------------------------------+
+```
+
+10. Multiple spaces and adjacent punctuation
+```sql
+SELECT INITCAP('word1   word2--word3'), INITCAP('hello, world! how are you?');
+```
+```text
++---------------------------------+---------------------------------------+
+| INITCAP('word1   word2--word3') | INITCAP('hello, world! how are you?') |
++---------------------------------+---------------------------------------+
+| Word1   Word2--Word3            | Hello, World! How Are You?            |
++---------------------------------+---------------------------------------+
 ```
\ No newline at end of file
diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/lcase.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/lcase.md
index 2dd9518adea..0476b8eedb4 100644
--- 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/lcase.md
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/lcase.md
@@ -74,3 +74,51 @@ SELECT LOWER(NULL), LCASE(NULL);
 | NULL        | NULL        |
 +-------------+-------------+
 ```
+
+4. Empty string
+```sql
+SELECT LOWER(''), LCASE('');
+```
+```text
++-----------+-----------+
+| LOWER('') | LCASE('') |
++-----------+-----------+
+|           |           |
++-----------+-----------+
+```
+
+5. String already lowercase or numeric-only
+```sql
+SELECT LOWER('already lowercase'), LCASE('abc123');
+```
+```text
++----------------------------+-----------------+
+| LOWER('already lowercase') | LCASE('abc123') |
++----------------------------+-----------------+
+| already lowercase          | abc123          |
++----------------------------+-----------------+
+```
+
+6. Non-alphabetic characters are passed through unchanged
+```sql
+SELECT LOWER('123!@#$%'), LCASE('PRICE: $99.99');
+```
+```text
++-------------------+------------------------+
+| LOWER('123!@#$%') | LCASE('PRICE: $99.99') |
++-------------------+------------------------+
+| 123!@#$%          | price: $99.99          |
++-------------------+------------------------+
+```
+
+7. UTF-8 multi-byte case folding
+```sql
+SELECT LOWER('ṬṚÌ TEST'), LCASE('ḌḌUMAI HELLO');
+```
+```text
++------------------------+---------------------------+
+| LOWER('ṬṚÌ TEST')      | LCASE('ḌḌUMAI HELLO')     |
++------------------------+---------------------------+
+| ṭṛì test               | ḍḍumai hello              |
++------------------------+---------------------------+
+```
diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/ltrim.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/ltrim.md
index 82427d7b6ba..1ef4b0a441b 100644
--- 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/ltrim.md
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/ltrim.md
@@ -76,3 +76,75 @@ SELECT LTRIM(NULL), LTRIM('test', NULL);
 | NULL        | NULL                |
 +-------------+---------------------+
 ```
+
+4. Empty inputs
+```sql
+SELECT LTRIM(''), LTRIM('test', '');
+```
+```text
++-----------+-------------------+
+| LTRIM('') | LTRIM('test', '') |
++-----------+-------------------+
+|           | test              |
++-----------+-------------------+
+```
+
+5. Strip a multi-character prefix
+```sql
+SELECT LTRIM('abcdefg', 'abc'), LTRIM('123456', '12');
+```
+```text
++-------------------------+-----------------------+
+| LTRIM('abcdefg', 'abc') | LTRIM('123456', '12') |
++-------------------------+-----------------------+
+| defg                    | 3456                  |
++-------------------------+-----------------------+
+```
+
+6. Entire string matches the trim chars
+```sql
+SELECT LTRIM('aaaaa', 'a'), LTRIM('   ', ' ');
+```
+```text
++---------------------+-------------------+
+| LTRIM('aaaaa', 'a') | LTRIM('   ', ' ') |
++---------------------+-------------------+
+|                     |                   |
++---------------------+-------------------+
+```
+
+7. UTF-8 substring strip (the second arg is matched as a literal substring, 
not a character set)
+```sql
+SELECT LTRIM('ṭṛìṭṛì test', 'ṭṛì'), LTRIM('ḍḍuḍḍu hello', 'ḍu');
+```
+```text
++--------------------------------------------+---------------------------------------+
+| LTRIM('ṭṛìṭṛì test', 'ṭṛì')                | LTRIM('ḍḍuḍḍu hello', 'ḍu')     
      |
++--------------------------------------------+---------------------------------------+
+|  test                                      | ḍḍuḍḍu hello                    
      |
++--------------------------------------------+---------------------------------------+
+```
+
+8. Strip a numeric prefix
+```sql
+SELECT LTRIM('000123', '0'), LTRIM('123abc123', '123');
+```
+```text
++----------------------+---------------------------+
+| LTRIM('000123', '0') | LTRIM('123abc123', '123') |
++----------------------+---------------------------+
+| 123                  | abc123                    |
++----------------------+---------------------------+
+```
+
+9. Strip a punctuation prefix
+```sql
+SELECT LTRIM('---text---', '-'), LTRIM('@@hello@@', '@');
+```
+```text
++--------------------------+-------------------------+
+| LTRIM('---text---', '-') | LTRIM('@@hello@@', '@') |
++--------------------------+-------------------------+
+| text---                  | hello@@                 |
++--------------------------+-------------------------+
+```
diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/replace.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/replace.md
index 48768367c31..0b6797cc91f 100644
--- 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/replace.md
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/replace.md
@@ -105,3 +105,51 @@ SELECT REPLACE('ṭṛì ḍḍumai test ṭṛì ḍḍumannàri', 'ṭṛì',
 | replaced ḍḍumai test replaced ḍḍumannàri                  |
 +-----------------------------------------------------------+
 ```
+
+6. Empty-string edge cases — empty `str` returns empty; empty `old` returns 
`str` unchanged; empty `new` deletes every match
+```sql
+SELECT REPLACE('', 'old', 'new'), REPLACE('test', '', 'new'), REPLACE('test', 
'old', '');
+```
+```text
++---------------------------+----------------------------+----------------------------+
+| REPLACE('', 'old', 'new') | REPLACE('test', '', 'new') | REPLACE('test', 
'old', '') |
++---------------------------+----------------------------+----------------------------+
+|                           | test                       | test                
       |
++---------------------------+----------------------------+----------------------------+
+```
+
+7. Replacement is case-sensitive (only lowercase `hello` matches)
+```sql
+SELECT REPLACE('Hello HELLO hello', 'hello', 'hi');
+```
+```text
++---------------------------------------------+
+| REPLACE('Hello HELLO hello', 'hello', 'hi') |
++---------------------------------------------+
+| Hello HELLO hi                              |
++---------------------------------------------+
+```
+
+8. `old` not present — returns `str` unchanged
+```sql
+SELECT REPLACE('hello world', 'xyz', 'abc');
+```
+```text
++--------------------------------------+
+| REPLACE('hello world', 'xyz', 'abc') |
++--------------------------------------+
+| hello world                          |
++--------------------------------------+
+```
+
+9. Overlap-free repeated match
+```sql
+SELECT REPLACE('123123123', '123', 'ABC');
+```
+```text
++------------------------------------+
+| REPLACE('123123123', '123', 'ABC') |
++------------------------------------+
+| ABCABCABC                          |
++------------------------------------+
+```
diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/xpath-string.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/xpath-string.md
index 9928650e593..4e909a2c9b0 100644
--- 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/xpath-string.md
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/xpath-string.md
@@ -83,7 +83,7 @@ SELECT xpath_string('<a><b>1</b><b>2</b></a>', '/a/b[2]');
 +----------------------------------------------------+
 ```
 
-5. Handling CDATA and comments
+5. NULL input
 ```sql
 SELECT xpath_string(NULL, '/a');
 ```
@@ -95,6 +95,48 @@ SELECT xpath_string(NULL, '/a');
 +--------------------------+
 ```
 
+6. CDATA sections — the CDATA payload is returned as plain text
+```sql
+SELECT xpath_string('<a><![CDATA[123]]></a>', '/a');
+```
+```text
++----------------------------------------------+
+| xpath_string('<a><![CDATA[123]]></a>', '/a') |
++----------------------------------------------+
+| 123                                          |
++----------------------------------------------+
+```
+
+7. XML comments are skipped
+```sql
+SELECT xpath_string('<a><!-- comment -->123</a>', '/a');
+```
+```text
++--------------------------------------------------+
+| xpath_string('<a><!-- comment -->123</a>', '/a') |
++--------------------------------------------------+
+| 123                                              |
++--------------------------------------------------+
+```
+
+8. Path does not match any node — returns empty string
+```sql
+SELECT xpath_string('<a>123</a>', '/b');
+```
+```text
++----------------------------------+
+| xpath_string('<a>123</a>', '/b') |
++----------------------------------+
+|                                  |
++----------------------------------+
+```
+
+9. Malformed XML — function raises an error
+```sql
+SELECT xpath_string('<a><!-- comment -->123/a>', '/a');
+ERROR 1105 (HY000): errCode = 2, detailMessage = [INVALID_ARGUMENT]Function 
xpath_string failed to parse XML string: Start-end tags mismatch
+```
+
 ### Keywords
 
     XPATH_STRING, XPATH, XML


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

Reply via email to