Skip to content

[fix](doc) field.md: add missing setup; reconcile zh result tables with NULL row#3789

Open
boluor wants to merge 2 commits into
apache:masterfrom
boluor:fix/field-add-setup-and-zh-result-rows
Open

[fix](doc) field.md: add missing setup; reconcile zh result tables with NULL row#3789
boluor wants to merge 2 commits into
apache:masterfrom
boluor:fix/field-add-setup-and-zh-result-rows

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 26, 2026

Summary

Doc pages (4.x): `scalar-functions/other-functions/field.md` (EN + ZH).

EN: The two table-based examples reference `baseall` and `class_test` but the page never created/inserted into them — copy-paste fails. Added a setup block that materializes both tables with the rows shown in the existing expected results (Suzi/Ben/Henry, no NULL).

ZH: Two problems.

  1. Same missing-setup issue as EN.
  2. Internal inconsistency: the basic ASC and DESC result tables show 6 rows (no NULL), but the NULLS FIRST result table shows 7 rows with a NULL. A single dataset cannot produce both. The prose immediately above the examples explicitly explains "对于 NULL 值,可以使用 nulls first 或 nulls last 控制排序顺序", confirming the author intends a dataset that contains NULL — so the basic ASC / DESC results, not the NULLS FIRST one, are the ones that are wrong.

The ZH fix:

  • Setup includes 7 rows (Suzi×2, Ben×2, Henry×2, NULL).
  • Basic ASC result: 7 rows, NULL first (`FIELD` returns 0 for values not in the list including NULL; Doris's default ASC puts NULLs first).
  • DESC result: 7 rows, NULL last.
  • NULLS FIRST result: unchanged (already correct).

Verification

Ran the setup + every example end-to-end on a single-node Apache Doris 4.1.1 cluster. Every documented result block in this PR now matches the cluster output exactly.

Split into 2 commits so the EN-only and ZH-only changes are easy to review separately.

Test plan

  • Run EN setup + all 3 EN examples → matches each documented result.
  • Run ZH setup + all 4 ZH examples → matches each documented result.
  • No prose changes; only example reproducibility/correctness.

🤖 Generated with Claude Code

boluor and others added 2 commits May 26, 2026 02:49
…_test

The two table-based examples reference baseall and class_test but the page
never defined them, so copy-paste/`source` of the snippets fails. Add a
setup block that creates both tables and inserts the rows shown in the
existing expected results (Suzi/Ben/Henry without NULL).

Verified on a single-node Apache Doris 4.1.1 cluster: with this setup all
three EN examples reproduce the documented output exactly.

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

Two problems on the ZH page:

1. baseall and class_test were referenced without being defined.
2. The basic ASC and DESC result tables showed 6 rows (no NULL), but
   the NULLS FIRST example showed 7 rows with a NULL — which is only
   reproducible against a single dataset if NULL is actually present.
   The prose right above the examples explicitly tells the reader to
   use `nulls first`/`nulls last` to control NULL ordering, confirming
   the author's intent is a dataset that includes NULL.

This change:
- Adds a setup block creating both tables and inserting the rows shown
  in the existing NULLS FIRST result (Suzi/Ben/Henry plus one NULL).
- Updates the basic ASC result to put NULL first (FIELD returns 0 for
  values not in the list, including NULL; Doris's default ASC orders
  NULLs first).
- Updates the DESC result to put NULL last.
- Leaves the NULLS FIRST example untouched — it already matched reality.

Verified on a single-node Apache Doris 4.1.1 cluster.

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