Skip to content

[fix](doc) v2.1/v3.x: correct ARRAY_ENUMERATE_UNIQ multi-array example result#3859

Open
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/array-enumerate-uniq-wrong-value
Open

[fix](doc) v2.1/v3.x: correct ARRAY_ENUMERATE_UNIQ multi-array example result#3859
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/array-enumerate-uniq-wrong-value

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 30, 2026

Problem

The multi-array example

select array_enumerate_uniq([1,1,1,1,1],[2,1,2,1,2],[3,1,3,1,3]);

is documented as [1, 1, 2, 1, 3], which is wrong. array_enumerate_uniq returns, for each position, the ordinal of that position's tuple among equal tuples. The by-position tuples here are:

(1,2,3) (1,1,1) (1,2,3) (1,1,1) (1,2,3)

so the ordinals are [1, 1, 2, 2, 3] — the 4th position is the 2nd occurrence of (1,1,1), not the 1st. The doc had 1 at the 4th position.

Scope

Present (and fixed) in v2.1 EN, v3.x EN, v3.x ZH. Already correct in v2.1 ZH, v4.x, and dev, so those are untouched.

This page's other examples are correct (checked by hand and on cluster): the single-array example [1,2,3,1,2,3] → [1,1,1,2,2,2] and the description prose [1,2,1,1,2],[2,1,2,2,1] → [1,1,2,3,2].

Note: this is a "both languages wrong" case on v3.x, so a cross-language diff doesn't reveal it — it was caught by a native v2.1 sweep where v2.1 ZH happened to already be correct.

Cluster verification (Doris 3.1.4-rc02 and 2.1.11-rc01, identical)

mysql> select array_enumerate_uniq([1, 1, 1, 1, 1], [2, 1, 2, 1, 2], [3, 1, 3, 1, 3]);
+-------------------------------------------------------------------------+
| array_enumerate_uniq([1, 1, 1, 1, 1], [2, 1, 2, 1, 2], [3, 1, 3, 1, 3]) |
+-------------------------------------------------------------------------+
| [1, 1, 2, 2, 3]                                                         |
+-------------------------------------------------------------------------+

🤖 Generated with Claude Code

…e result

The multi-array example
  select array_enumerate_uniq([1,1,1,1,1],[2,1,2,1,2],[3,1,3,1,3]);
is documented as [1, 1, 2, 1, 3], which is wrong. array_enumerate_uniq
returns, for each position, the ordinal of that position's tuple among equal
tuples. The by-position tuples here are:
  (1,2,3) (1,1,1) (1,2,3) (1,1,1) (1,2,3)
so the ordinals are [1, 1, 2, 2, 3] (the 4th position is the 2nd occurrence
of (1,1,1), not the 1st). The doc had 1 at the 4th position.

Present (and fixed) in: v2.1 EN, v3.x EN, v3.x ZH.
Already correct in v2.1 ZH, v4.x and dev, so they are untouched.

This page's other examples are correct (verified by hand and on cluster):
  - single array [1,2,3,1,2,3] -> [1,1,1,2,2,2]
  - description prose [1,2,1,1,2],[2,1,2,2,1] -> [1,1,2,3,2]

Cluster verification (Doris 3.1.4-rc02 and 2.1.11-rc01, both identical):

  mysql> select array_enumerate_uniq([1, 1, 1, 1, 1], [2, 1, 2, 1, 2], [3, 1, 3, 1, 3]);
  +-------------------------------------------------------------------------+
  | array_enumerate_uniq([1, 1, 1, 1, 1], [2, 1, 2, 1, 2], [3, 1, 3, 1, 3]) |
  +-------------------------------------------------------------------------+
  | [1, 1, 2, 2, 3]                                                         |
  +-------------------------------------------------------------------------+

Co-Authored-By: Claude Opus 4.8 (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