From 63a42615fb0d9fc1b2f8f6a6fcd9078d20359884 Mon Sep 17 00:00:00 2001 From: boluor Date: Tue, 26 May 2026 07:33:05 -0700 Subject: [PATCH] [fix](doc) trim.md en: 2-arg trim peels both sides repeatedly, result is 'cca' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The EN example claimed: SELECT trim('ababccaab', 'ab') str; -> 'ababcca' On Apache Doris 4.1.1 the actual result is 'cca' — `trim(, )` strips `` from BOTH the leading and trailing ends of ``, and repeats until neither end has `` as a prefix/suffix. So 'ababccaab' peels 'ab' twice from the front and once from the back, leaving 'cca'. ZH already shows 'cca'. Update EN's expected output and add a one-line intro that calls out the "both ends, repeatedly" semantics, so the result no longer looks surprising. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../scalar-functions/string-functions/trim.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/trim.md b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/trim.md index 04ae68fee9d52..3201e5aed702e 100644 --- a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/trim.md +++ b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/trim.md @@ -46,16 +46,16 @@ SELECT trim(' ab d ') str; +------+ ``` -2. Remove specified strings from both ends +2. Remove specified strings from both ends — `trim(str, rhs)` repeatedly strips `` from both the leading and trailing ends of `` until neither end starts/ends with ``. ```sql SELECT trim('ababccaab', 'ab') str; ``` ```text -+---------+ -| str | -+---------+ -| ababcca | -+---------+ ++------+ +| str | ++------+ +| cca | ++------+ ``` 3. UTF-8 character support