-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[fix](json-functions)fix json-replace/insert/set/array behavior with complex type #50308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix](json-functions)fix json-replace/insert/set/array behavior with complex type #50308
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
TPC-H: Total hot run time: 33763 ms
|
TPC-DS: Total hot run time: 184885 ms
|
ClickBench: Total hot run time: 29.97 s
|
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
List<DataType> arguments = new ArrayList<>(); | ||
arguments.add(VarcharType.SYSTEM_DEFAULT); // json_str | ||
for (int i = 1; i < arity(); i++) { | ||
if ((i & 1) == 0 && (getArgumentType(i).isComplexType() || getArgumentType(i).isJsonType())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does (i & 1) == 0
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(i & 1) == 0 determines the even position, which exactly corresponds to the position of the value parameter. pass the origin value type to BE and should not cast to varchar
BE Regression P0 && UT Coverage ReportIncrement line coverage Increment coverage report
|
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
run feut |
…complex type (#50308) ### What problem does this PR solve? here are some functions behavior is not same with mysql as JSON_REPLACE | JSON_INSERT | JSON_SET | JSON_ARRAY which json and complex types are not supported before this PR Follow mysql : https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-set before we will meet result: ``` mysql> insert into t01 values (1, '{"a":1, "b":2}'); Query OK, 1 row affected (0.25 sec) {'label':'label_1056456f8d8c46e5_9be38bb344bdd72c', 'status':'VISIBLE', 'txnId':'8019'} mysql> select b, json_set(b, "$.a", b) from t01; +---------------+-----------------------+ | b | json_set(b, "$.a", b) | +---------------+-----------------------+ | {"a":1,"b":2} | {"a":1,"b":2} | +---------------+-----------------------+ ``` now ``` mysql> select b, json_set(b, "$.a", b) from t01; +---------------+---------------------------+ | b | json_set(b, "$.a", b) | +---------------+---------------------------+ | {"a":1,"b":2} | {"a":{"a":1,"b":2},"b":2} | +---------------+---------------------------+ 1 row in set (0.12 sec) ```
…complex type #50308 (#50309) ### What problem does this PR solve? backport: #50308 Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
What problem does this PR solve?
here are some functions behavior is not same with mysql as JSON_REPLACE | JSON_INSERT | JSON_SET | JSON_ARRAY
which json and complex types are not supported before this PR
Follow mysql : https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-set
before we will meet result:
now
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)