Skip to content

[fix](doc) dev: fix array_count nested higher-order example (EN)#3866

Open
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/array-count-nested-dev-en
Open

[fix](doc) dev: fix array_count nested higher-order example (EN)#3866
boluor wants to merge 1 commit into
apache:masterfrom
boluor:fix/array-count-nested-dev-en

Conversation

@boluor
Copy link
Copy Markdown
Contributor

@boluor boluor commented May 30, 2026

What

The dev EN array-count page presented this nested higher-order example as if it works, claiming a result of 2:

SELECT array_count(x -> array_exists(y -> y > 5, x), [[1,2,3],[4,5,6],[7,8,9]]);

But array_exists returns an ARRAY (one boolean per inner element), and array_count expects the lambda body to return a scalar it can cast to BOOLEAN. On a live cluster this errors:

ERROR 1105 (HY000): errCode = 2, detailMessage =
  Can not find the compatibility function signature: array_count(ARRAY<ARRAY<BOOLEAN>>)

Fix

This is intended behavior, not a signature gap — the dev ZH, v4.x ZH and v4.x EN pages already document this exact error as the "lambda returns an array" failure case. This PR brings dev EN in line with the v4.x EN treatment: show the signature error, then give a working alternative whose lambda returns a scalar BOOLEAN:

SELECT array_count(x -> size(array_filter(y -> y > 5, x)) > 0, [[1,2,3],[4,5,6],[7,8,9]]);
-- 2

Verified live

Both statements run on a master daily build (doris-0.0.0-2e72603618c): the first reproduces the signature error verbatim, the second returns 2.

Scope

EN-only. dev ZH, v4.x EN and v4.x ZH already document the error correctly, so no backport is needed.

🤖 Generated with Claude Code

The dev EN array-count page presented this nested example as if it works,
claiming a result of 2:

    SELECT array_count(x -> array_exists(y -> y > 5, x), [[1,2,3],[4,5,6],[7,8,9]]);

But `array_exists` returns an ARRAY (one boolean per inner element), and
`array_count` expects the lambda to return a scalar it can cast to BOOLEAN,
so this errors on a live cluster:

    ERROR 1105 (HY000): errCode = 2, detailMessage =
      Can not find the compatibility function signature: array_count(ARRAY<ARRAY<BOOLEAN>>)

This is intended behavior, not a signature gap: the dev ZH, v4.x ZH and v4.x
EN pages already document this exact error as the "lambda returns array"
failure case. Mirror the v4.x EN treatment — show the signature error, then
give a working alternative that returns a scalar BOOLEAN:

    SELECT array_count(x -> size(array_filter(y -> y > 5, x)) > 0, [[1,2,3],[4,5,6],[7,8,9]]);
    -> 2

Both statements verified live on a master daily build. EN-only; the other
three pages were already correct, so no backport is needed.

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