Skip to content

[fix](doc) trim-in.md en: trim('ababccaab','ab') now returns 'cca', not 'ababccaab'#3811

Open
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/trim-in-en-compare-actual
Open

[fix](doc) trim-in.md en: trim('ababccaab','ab') now returns 'cca', not 'ababccaab'#3811
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/trim-in-en-compare-actual

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 26, 2026

Summary

Doc page (4.x): `scalar-functions/string-functions/trim-in.md` (EN).

The "Comparison with TRIM" example claimed that:

```sql
SELECT trim_in('ababccaab', 'ab'), trim('ababccaab', 'ab');
```

returns:

trim_in trim
cc ababccaab

On Apache Doris 4.1.1 the second column is `cca`, not the input unchanged. `trim(, )` peels the literal `` from both ends and repeats until neither end matches, so `'ababccaab'` peels `'ab'` twice from the front and once from the back, leaving `'cca'`.

The side-by-side example's pedagogical point still works — `trim_in` treats the 2nd arg as a character set (peels any `a` or `b`) while `trim` treats it as a literal substring (peels exact `ab`) — just with different output. Update the result row to match cluster reality and tighten the intro prose to call out the char-set-vs-substring contrast more clearly. See PR #3810 for the companion fix on trim.md's own page.

Verification

```
mysql> SELECT trim_in('ababccaab', 'ab'), trim('ababccaab', 'ab');
+----------------------------+-------------------------+
| trim_in('ababccaab', 'ab') | trim('ababccaab', 'ab') |
+----------------------------+-------------------------+
| cc | cca |
+----------------------------+-------------------------+
```

Test plan

  • Run on a 4.1.1 cluster — matches the new result row.
  • Divider widths updated to fit the shorter values.
  • No other change.

🤖 Generated with Claude Code

… 4.x, not 'ababccaab'

The "Comparison with TRIM" example in the EN page claimed that
`trim('ababccaab', 'ab')` returns the input unchanged. On Apache
Doris 4.1.1 `trim(str, rhs)` strips the literal `<rhs>` from both
ends and repeats until neither end matches, so it returns 'cca'.
The point of the side-by-side example (trim_in treats the 2nd arg
as a char SET; trim treats it as a literal SUBSTRING) still holds,
but with different output. Update the expected output and the intro
prose to call out the contrast more precisely.

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