Skip to content

branch-4.1: [fix](be) Fix json contains duplicate array candidates #63301#63339

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-63301-branch-4.1
May 20, 2026
Merged

branch-4.1: [fix](be) Fix json contains duplicate array candidates #63301#63339
yiguolei merged 1 commit into
branch-4.1from
auto-pick-63301-branch-4.1

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Cherry-picked from #63301

Problem Summary: `json_contains('[1,1,1]', '[1,1]')` should return true,
but the previous JSONB array containment logic counted matching target
elements and compared that count with the candidate array length.
Duplicate candidate elements therefore produced incorrect false results.
This change checks each candidate array element independently against
the target array, matching non-consuming containment semantics.

### Release note

Fix `json_contains` returning false when the candidate array contains
duplicate elements already present in the target array.

### Check List (For Author)

- Test: Unit Test
    - `./run-be-ut.sh --run --filter=JsonbContainsTest.* -j 32`
    - `build-support/check-format.sh`
    - `git diff --check 66dbb85..HEAD`
- `build-support/run-clang-tidy.sh --build-dir be/ut_build_ASAN` (failed
because clang-tidy could not analyze existing headers in this
environment: `be/src/core/types.h` has an unmatched `NOLINTEND`, and the
toolchain could not resolve `stddef.h`/intrinsic headers)
- Behavior changed: Yes
- `json_contains` now follows non-consuming array containment semantics
for duplicate candidate elements.
- Does this need documentation: No
@github-actions github-actions Bot requested a review from yiguolei as a code owner May 18, 2026 03:55
@yiguolei
Copy link
Copy Markdown
Contributor

run buildall

@yiguolei yiguolei closed this May 20, 2026
@yiguolei yiguolei reopened this May 20, 2026
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Copy Markdown
Contributor Author

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit e381f9d into branch-4.1 May 20, 2026
29 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants