Skip to content
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

[feature](json-function) add json_insert, json_replace, json_set functions #24384

Merged
merged 8 commits into from
Sep 25, 2023

Conversation

xuefengze
Copy link
Contributor

Proposed changes

Issue Number: close #21268

add json_insert, json_replace, json_set functions

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@xuefengze
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.94% (7975/21587)
Line Coverage: 28.89% (63915/221218)
Region Coverage: 27.82% (33167/119236)
Branch Coverage: 24.39% (17023/69782)
Coverage Report: http://coverage.selectdb-in.cc/coverage/12db03f306c08d9fb4aaa3db5aacaea8c5a635f8_12db03f306c08d9fb4aaa3db5aacaea8c5a635f8/report/index.html

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 46.83 seconds
stream load tsv: 600 seconds loaded 74807831229 Bytes, about 118 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 30 seconds loaded 861443392 Bytes, about 27 MB/s
insert into select: 29.0 seconds inserted 10000000 Rows, about 344K ops/s
storage size: 17162433739 Bytes

@xuefengze
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.93% (7973/21587)
Line Coverage: 28.88% (63889/221232)
Region Coverage: 27.80% (33151/119243)
Branch Coverage: 24.38% (17014/69788)
Coverage Report: http://coverage.selectdb-in.cc/coverage/c5084c2b6a51e56c25a16c8dad6e5648e8f10c81_c5084c2b6a51e56c25a16c8dad6e5648e8f10c81/report/index.html

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 46.47 seconds
stream load tsv: 600 seconds loaded 74807831229 Bytes, about 118 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 33 seconds loaded 861443392 Bytes, about 24 MB/s
insert into select: 28.9 seconds inserted 10000000 Rows, about 346K ops/s
storage size: 17162468413 Bytes

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@xuefengze
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 48.48 seconds
stream load tsv: 595 seconds loaded 74807831229 Bytes, about 119 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 28.7 seconds inserted 10000000 Rows, about 348K ops/s
storage size: 17162482677 Bytes

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.93% (7975/21593)
Line Coverage: 28.87% (63916/221401)
Region Coverage: 27.80% (33170/119313)
Branch Coverage: 24.38% (17023/69830)
Coverage Report: http://coverage.selectdb-in.cc/coverage/0420ca994142dd0a6573448ae4e1bd5da0f796a9_0420ca994142dd0a6573448ae4e1bd5da0f796a9/report/index.html

@xuefengze
Copy link
Contributor Author

run p0

@@ -1131,6 +1131,319 @@ class FunctionJsonUnquote : public IFunction {
}
};

struct FunctionJsonInsert {
static constexpr auto name = "json_insert";
static constexpr auto is_insert = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use enum? boolean value is not intuitive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it.

auto tok = get_json_token(path_string);
#endif
std::vector<std::string> paths(tok.begin(), tok.end());
auto status = get_parsed_paths_with_status(paths, &parsed_paths);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use macro RETURN_IF_ERROR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


std::vector<std::vector<std::vector<JsonPath>>> json_paths;
auto status = get_parsed_path_columns(json_paths, data_columns, input_rows_count);
if (UNLIKELY(status != Status::OK())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use macro RETURN_IF_ERROR?

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@xuefengze
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.83% (7981/21667)
Line Coverage: 28.84% (64029/221999)
Region Coverage: 27.76% (33216/119635)
Branch Coverage: 24.36% (17047/69976)
Coverage Report: http://coverage.selectdb-in.cc/coverage/c6e7e1f8d0cba04973fcad841408bb4edb74f931_c6e7e1f8d0cba04973fcad841408bb4edb74f931/report/index.html

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.72 seconds
stream load tsv: 593 seconds loaded 74807831229 Bytes, about 120 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 28.7 seconds inserted 10000000 Rows, about 348K ops/s
storage size: 17162182638 Bytes

@xuefengze
Copy link
Contributor Author

run p0

eldenmoon
eldenmoon previously approved these changes Sep 16, 2023
Copy link
Member

@eldenmoon eldenmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 16, 2023
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@xuefengze
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 46.06 seconds
stream load tsv: 594 seconds loaded 74807831229 Bytes, about 120 MB/s
stream load json: 21 seconds loaded 2358488459 Bytes, about 107 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
insert into select: 28.7 seconds inserted 10000000 Rows, about 348K ops/s
storage size: 17162380267 Bytes

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.80% (7980/21682)
Line Coverage: 28.82% (64021/222153)
Region Coverage: 27.71% (33226/119912)
Branch Coverage: 24.33% (17028/69990)
Coverage Report: http://coverage.selectdb-in.cc/coverage/4cc611a0f374695295bf379236d13094de59b279_4cc611a0f374695295bf379236d13094de59b279/report/index.html

@xuefengze
Copy link
Contributor Author

run p0

1 similar comment
@xuefengze
Copy link
Contributor Author

run p0

eldenmoon
eldenmoon previously approved these changes Sep 19, 2023
Copy link
Member

@eldenmoon eldenmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 19, 2023
@github-actions
Copy link
Contributor

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

@yiguolei
Copy link
Contributor

@xuefengze Hi, the code is conflict. Could you please resolve conflicts?

@yiguolei
Copy link
Contributor

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Sep 22, 2023
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@yiguolei
Copy link
Contributor

I have resolve the conflict and rebuild all

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 45.25 seconds
stream load tsv: 601 seconds loaded 74807831229 Bytes, about 118 MB/s
stream load json: 21 seconds loaded 2358488459 Bytes, about 107 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.5 seconds inserted 10000000 Rows, about 350K ops/s
storage size: 17162495202 Bytes

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.38% (8022/22050)
Line Coverage: 28.66% (64425/224753)
Region Coverage: 27.57% (33460/121347)
Branch Coverage: 24.24% (17116/70622)
Coverage Report: http://coverage.selectdb-in.cc/coverage/95f4cb0adb2b4b0fcbaf43f51f1d4eb5a9c58366_95f4cb0adb2b4b0fcbaf43f51f1d4eb5a9c58366/report/index.html

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 23, 2023
@github-actions
Copy link
Contributor

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

Copy link
Member

@eldenmoon eldenmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eldenmoon eldenmoon merged commit 1b95ce1 into apache:master Sep 25, 2023
23 of 25 checks passed
xiaokang pushed a commit to xiaokang/doris that referenced this pull request Sep 27, 2023
…tions (apache#24384)

 [feature](json-function) add three json funcitons
xiaokang pushed a commit that referenced this pull request Oct 3, 2023
…tions (#24384)

 [feature](json-function) add three json funcitons
@xuefengze xuefengze deleted the add_func_modifyjsonvalue branch November 14, 2023 05:32
@xiaokang xiaokang mentioned this pull request Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.0.3-merged merge_conflict reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Improve Json function for doris
5 participants