[fix](doc) trim.md en: 2-arg trim peels both sides repeatedly; result is 'cca'#3810
Open
boluor wants to merge 1 commit into
Open
[fix](doc) trim.md en: 2-arg trim peels both sides repeatedly; result is 'cca'#3810boluor wants to merge 1 commit into
boluor wants to merge 1 commit into
Conversation
… is 'cca'
The EN example claimed:
SELECT trim('ababccaab', 'ab') str; -> 'ababcca'
On Apache Doris 4.1.1 the actual result is 'cca' — `trim(<str>, <rhs>)`
strips `<rhs>` from BOTH the leading and trailing ends of `<str>`, and
repeats until neither end has `<rhs>` 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) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Doc page (4.x): `scalar-functions/string-functions/trim.md` (EN).
The 2-arg trim example claimed:
```sql
SELECT trim('ababccaab', 'ab') str;
```
```
| str |
| ababcca |
```
On Apache Doris 4.1.1 the cluster returns `cca`, not `ababcca`. `trim(, )` strips `` from BOTH ends and repeats until neither end starts/ends with ``:
```
'ababccaab' -> peel 'ab' from front: 'abccaab' -> peel 'ab' again: 'ccaab' (front stops)
'ccaab' -> peel 'ab' from back: 'cca' (back stops)
final: 'cca'
```
The ZH counterpart 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.
Verification
```
mysql> SELECT trim('ababccaab', 'ab') str;
+------+
| str |
+------+
| cca |
+------+
```
Test plan
🤖 Generated with Claude Code