[fix](doc) dev: fix array_count nested higher-order example (EN)#3866
Open
boluor wants to merge 1 commit into
Open
[fix](doc) dev: fix array_count nested higher-order example (EN)#3866boluor wants to merge 1 commit into
boluor wants to merge 1 commit into
Conversation
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>
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.
What
The dev EN
array-countpage presented this nested higher-order example as if it works, claiming a result of2:But
array_existsreturns an ARRAY (one boolean per inner element), andarray_countexpects the lambda body to return a scalar it can cast to BOOLEAN. On a live cluster this errors: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:
Verified live
Both statements run on a master daily build (
doris-0.0.0-2e72603618c): the first reproduces the signature error verbatim, the second returns2.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