Skip to content

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

Merged
morningman merged 2 commits into
branch-4.0from
auto-pick-63301-branch-4.0
Jun 25, 2026
Merged

branch-4.0: [fix](be) Fix json contains duplicate array candidates #63301#63338
morningman merged 2 commits into
branch-4.0from
auto-pick-63301-branch-4.0

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #63301

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Jun 24, 2026
@github-actions

Copy link
Copy Markdown
ContributorAuthor

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

@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by anyone and no changes requested.

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
@morningman
morningmanforce-pushed the auto-pick-63301-branch-4.0 branch from 8786ecd to 0947acbCompareJune 24, 2026 09:53
@morningman

Copy link
Copy Markdown
Contributor

run buildall

morningman
morningman previously approved these changes Jun 24, 2026
@mrhhsg

Copy link
Copy Markdown
Member

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (21/21) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.36% (19499/36544)
Line Coverage36.46% (182387/500210)
Region Coverage33.04% (141745/429020)
Branch Coverage33.93% (61353/180836)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (21/21) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.48% (25555/35752)
Line Coverage54.37% (271072/498553)
Region Coverage52.00% (224877/432459)
Branch Coverage53.40% (96802/181262)

@morningman
morningman merged commit 9278828 into branch-4.0Jun 25, 2026
30 of 33 checks passed
@github-actions
github-actionsBot deleted the auto-pick-63301-branch-4.0 branch June 25, 2026 02:13
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@hello-stephen@morningman@mrhhsg