[fix](json) avoid json_set crash on invalid jsonb value#64088
Open
mrhhsg wants to merge 1 commit into
Open
Conversation
### What problem does this PR solve?
Issue Number: None
Problem Summary: json_set may receive an invalid JSONB payload from a nullable expression and crash when converting it to rapidjson.
### Release note
None
### Check List (For Author)
- Test:
- Regression test: doris-local-regression --network 10.26.20.3/24 --offset 42300 run -d nereids_p0/sql_functions/json_function -s test_query_json_set_jsonb_nullable_value
- Build: doris-local-regression --network 10.26.20.3/24 --offset 42300 build
- Behavior changed: No
- Does this need documentation: No
Member
Author
|
/review |
Contributor
There was a problem hiding this comment.
Review opinion: the PR looks safe to proceed. I did not find any critical blocking issues in the changed backend logic or regression test.
Critical checkpoints:
- Correctness: The nullable constant index fix uses the same indexed row for both the value column and its null map, which addresses the likely out-of-bounds/crash path. The JSONB null fallback also prevents dereferencing a null
JsonbValue. - Scope/regression risk: The JSONB parser fallback is global to the JSON function value parser, but it maps unparsable JSONB payloads to JSON null rather than crashing; I did not find a concrete incompatible behavior regression in this PR context.
- Tests: The new regression covers nullable JSONB values and the invalid JSONB crash scenario with enough rows to exercise vectorized row/null-map handling.
git diff --checkpassed locally. - Documentation/compatibility: No user-facing syntax or documented behavior change found that requires docs.
- User focus: No additional user-provided review focus was present.
Member
Author
|
run buildall |
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 problem does this PR solve?
Issue Number: None
Problem Summary:
json_setmay receive an invalid JSONB payload from a nullable expression and crash when converting it to rapidjson. This patch treats invalid JSONB payloads as JSON null in the json modify value path and uses the correct row index for nullable constant value columns.Release note
None
Check List (For Author)
doris-local-regression --network 10.26.20.3/24 --offset 42300 builddoris-local-regression --network 10.26.20.3/24 --offset 42300 run -d nereids_p0/sql_functions/json_function -s test_query_json_set_jsonb_nullable_valuegit diff --check