Skip to content

[fix](doc) trim.md en: 2-arg trim peels both sides repeatedly; result is 'cca'#3810

Open
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/trim-en-2arg-actual-output
Open

[fix](doc) trim.md en: 2-arg trim peels both sides repeatedly; result is 'cca'#3810
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/trim-en-2arg-actual-output

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 26, 2026

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

  • Run on a 4.1.1 cluster — returns `cca`.
  • Result-table widths updated to fit the shorter value.
  • No other change.

🤖 Generated with Claude Code

… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant