Skip to content

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

Open
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-63301-branch-4.0
Open

branch-4.0: [fix](be) Fix json contains duplicate array candidates #63301#63338
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-63301-branch-4.0

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
@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

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.

2 participants