[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
Open
[fix](doc) replace-empty.md: align en/zh examples and add NULL/UTF-8 corner cases#3790boluor wants to merge 3 commits into
boluor wants to merge 3 commits into
Conversation
…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>
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/replace-empty.md(EN + ZH).This PR keeps the EN and ZH pages in lockstep with each other while adding the missing corner cases:
SELECT replace('hello world', 'world', 'universe')example, but it is now framed explicitly as a contrast baseline under "For reference" — readers see plainREPLACEbehavior first, then the numbered list below shows whereREPLACE_EMPTYdiffers.<str>/ NULL propagation / multi-byte (ṭṛìṭ)<new>. The NULL and UTF-8 cases were already on ZH; this brings EN up to parity.<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
REPLACE_EMPTYbehavior is unchanged; only doc text/examples are updated.🤖 Generated with Claude Code