Skip to content

[fix](doc) replace-empty.md: align en/zh examples and add NULL/UTF-8 corner cases#3790

Open
boluor wants to merge 3 commits into
apache:masterfrom
boluor:fix/replace-empty-en-align-with-zh
Open

[fix](doc) replace-empty.md: align en/zh examples and add NULL/UTF-8 corner cases#3790
boluor wants to merge 3 commits into
apache:masterfrom
boluor:fix/replace-empty-en-align-with-zh

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 26, 2026

Summary

Doc page (4.x): scalar-functions/string-functions/replace-empty.md (EN + ZH).

This PR keeps the EN and ZH pages in lockstep with each other while adding the missing corner cases:

  1. Both sides keep the original SELECT replace('hello world', 'world', 'universe') example, but it is now framed explicitly as a contrast baseline under "For reference" — readers see plain REPLACE behavior first, then the numbered list below shows where REPLACE_EMPTY differs.
  2. Both sides now share the same numbered list of REPLACE_EMPTY examples covering: insert behavior / plain replace / empty <str> / NULL propagation / multi-byte (ṭṛìṭ) <new>. The NULL and UTF-8 cases were already on ZH; this brings EN up to parity.
  3. EN's Return Value section gains the "if <old> is not in <str>, returns <str> unchanged" specification line and notes the VARCHAR return type — both were already on ZH.

Verification

Every SQL example was run against a single-node Apache Doris 4.1.1 cluster using the actual mysql/mariadb client; the result blocks in this PR are the verbatim CLI output (including the wider padding MariaDB emits on the UTF-8 row, which is matched character-for-character).

Test plan

  • Run every example on a 4.1.1 cluster — all 6 (1 reference + 5 numbered) match the result blocks exactly.
  • EN and ZH structure now identical: same intro, same numbered examples in the same order.
  • Confirm REPLACE_EMPTY behavior is unchanged; only doc text/examples are updated.

🤖 Generated with Claude Code

boluor and others added 3 commits May 26, 2026 02:59
…ng replace() snippet

Three issues on the EN page that the ZH version already addresses:

1. Example 1 used `replace()` instead of `replace_empty()`. On a page
   titled REPLACE_EMPTY this just looks like wrong code — the doc prose
   never explains it as a contrast example.
2. Missing examples for NULL propagation and multi-byte `<new>`. ZH has
   both and they are the corner cases readers most often check.
3. Return-value section was missing the "if <old> is not in <str>,
   returns <str> unchanged" specification line.

This change mirrors the ZH page's 5 numbered examples (insert / plain
replace / empty str / NULL / UTF-8), adds the missing return-value
bullet, and notes the VARCHAR return type. Every example was run on a
single-node Apache Doris 4.1.1 cluster and the result blocks are
byte-for-byte the mysql client output (including the wider padding
MariaDB emits for the UTF-8 row).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…contrast baseline

The previous commit dropped the original `SELECT replace('hello world',
'world', 'universe')` example because it was unframed and looked like a
copy-paste mistake. On reflection it is genuinely useful as a baseline:
seeing what plain REPLACE does first makes the REPLACE_EMPTY-only insert
behavior easier to grasp. Restore it under an explicit "For reference"
intro that names the contrast, and tie it to the numbered examples that
follow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…or en

Keep the EN and ZH pages in lockstep — the previous commit on the EN
side added a "For reference" plain-REPLACE baseline above the numbered
REPLACE_EMPTY examples; mirror the same intro on the ZH page so the
two stay aligned.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@boluor boluor changed the title [fix](doc) replace-empty.md en: align examples with zh, drop misleading replace() snippet [fix](doc) replace-empty.md: align en/zh examples and add NULL/UTF-8 corner cases May 26, 2026
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