[fix](doc) ltrim.md zh example 3: correct expected output (LTRIM does NOT strip \t / \n by default)#3838
Merged
morningman merged 1 commit intoMay 30, 2026
Conversation
… NOT strip \t / \n by default)
The original ZH example 3 ('多种空白字符处理') ran
LTRIM(' \t\n hello world')
and claimed the result was 'hello world'. That is wrong: by default
LTRIM strips only ASCII space, not tab (\t) or newline (\n), so the
actual result is '\t\n hello world' -- two characters shorter than
the input (the two leading spaces), not 6 chars shorter.
Rewrote the example along the same lines as RTRIM's '默认只剥除 ASCII
空格' example (added to en/zh recently): compare LENGTH() before and
after to make the behavior unambiguous. Output verified on Doris 4.1.1:
LENGTH(' \t\n hello world') -> 17
LENGTH(LTRIM(' \t\n hello world')) -> 15
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
morningman
pushed a commit
that referenced
this pull request
May 30, 2026
…orner-case adds (en+zh) (#3848) ## Summary Mechanical port of the 4.x fixes in #3833, #3837, #3838, #3839 to dev/master. Verified against today's master build (selectdb-qa-test tarball). **Skipped** (already applied on dev): - strleft.md ZH dedup (#3837) - milliseconds-add.md EN BIGINT-range example (#3834 EN-side; the ZH duplicate-removal piece is in the sibling PR) ## Files (13) ### EN string-functions - **from-base64.md, instr.md, length.md, locate.md, lpad.md** — backport corner-case examples (NULL / empty / multi-byte UTF-8 / numeric / etc.) added in #3833 - **rtrim.md** — add the LENGTH-based 'default-only-strips-ASCII-space' example (#3837) - **substring.md** — add the missing 'empty source string' example + 'NULL passed directly' (#3839) - **trim.md** — replace example 2's prose + expected output (`trim('ababccaab', 'ab')` is `cca`, not `ababcca` — trim repeatedly strips from both ends), plus the UTF-8 multi-byte-pattern example (#3839) ### EN other-functions - **field.md** — full replace with 4.x post-fix version: adds CREATE TABLE setup for `baseall` and `class_test` (which the page references but never created), adds a NULL row to `class_test`, adds DESC and NULLS FIRST examples that exercise NULL handling (#3789 + #3839 combined) ### ZH - **field.md** — add the simple `SELECT FIELD(2, 3, 1, 2, 5)` example (#3839) - **ltrim.md** — rewrite example 3 with correct expected output; LTRIM strips ASCII space only, NOT `\t`/`\n`, so the result still contains the tab/newline. Switched to a LENGTH() comparison for clarity (#3838) - **substring.md** — add the SUBSTR alias example (#3839) - **trim.md** — add three examples (no-match returns original; repeated pattern strips until exhausted; asymmetric removal with multi-char pattern). Also drop a trailing `;;` typo (#3839) ## Verification Verified end-to-end against today's master cluster — all added / modified examples behave identically on master as on 4.1.1, so the doc fixes apply unchanged. ## Related 4.x PRs #3833 #3837 #3838 #3839 (and #3789 for the field.md setup blocks). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
The original ZH example 3 ("多种空白字符处理") in
ltrim.mdran:and claimed the result was
hello world. That's wrong: by defaultLTRIMstrips only ASCII space, not tab (\t) or newline (\n), so the actual result is\t\n hello world— two characters shorter than the input (the two leading spaces), not six chars shorter.Rewrote the example along the same lines as the corresponding RTRIM "默认只剥除 ASCII 空格" example: compare
LENGTH()before and after the call so the behavior is unambiguous and the doc renders cleanly without embedded tabs/newlines in the result table.Verification
On Doris 4.1.1:
So only 2 chars (the two leading spaces) are removed, as documented now.
Context
Originally flagged when this example was excluded from the bulk ZH→EN backport in PR #3833 (the only zh-only ltrim example whose expected output didn't match reality on the cluster).
🤖 Generated with Claude Code