Uh oh!
There was an error while loading. Please reload this page.
branch-4.1: [fix](be) Avoid unsigned underflow in JSON modify path #63579 - #64191
Merged
Conversation
### What problem does this PR solve? Issue Number: None Problem Summary: JSON modify functions build a parent path by iterating to the element before the last JSON path leg. The loop used `get_leg_vector_size() - 1` on an unsigned size, which can underflow for an empty path expression even though normal root-path execution resolves to the root value before that branch. This patch caches the leg count once, asserts the non-empty invariant for the insert-parent branch, and uses `j + 1 < legs_count` to avoid unsigned subtraction while preserving behavior. The patch also adds BE unit coverage for missing-path JSONB modify cases where the parent path has to be rebuilt, including single-leg object insertion, nested object insertion, and array append behavior for both `jsonb_insert` and `jsonb_set`. ### Release note None ### Check List (For Author) - Test: - Unit Test: added `FunctionJsonbTEST.JsonbModifyMissingPathParent` - Build check: `DORIS_HOME=/mnt/disk7/hushenggang/doris-fix-spill ninja -C be/ut_build_ASAN test/CMakeFiles/doris_be_test.dir/exprs/function/function_jsonb_test.cpp.o` - Format check: `build-support/clang-format.sh`; `build-support/check-format.sh`; `git diff --check` - Behavior changed: No - Does this need documentation: No
hello-stephen
commented
Jun 8, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
hello-stephen
commented
Jun 8, 2026
Contributor
run buildall |
yiguolei
approved these changes
Jun 8, 2026
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Cherry-picked from #63579