-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Feature](json) Support json_search function in 2.1 #41590
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
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
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.
clang-tidy made some suggestions
| bool seek(const char* string, size_t length); | ||
|
|
||
| void add_leg_to_leg_vector(std::unique_ptr<leg_info> leg) { | ||
| leg_vector.emplace_back(leg.release()); |
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.
warning: use of undeclared identifier 'leg_vector' [clang-diagnostic-error]
leg_vector.emplace_back(leg.release());
^| leg_vector.emplace_back(leg.release()); | ||
| } | ||
|
|
||
| void pop_leg_from_leg_vector() { leg_vector.pop_back(); } |
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.
warning: use of undeclared identifier 'leg_vector' [clang-diagnostic-error]
void pop_leg_from_leg_vector() { leg_vector.pop_back(); }
^|
|
||
| bool to_string(std::string* res) const { | ||
| res->push_back(SCOPE); | ||
| for (const auto& leg : leg_vector) { |
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.
warning: use of undeclared identifier 'leg_vector' [clang-diagnostic-error]
for (const auto& leg : leg_vector) {
^| return true; | ||
| } | ||
|
|
||
| size_t get_leg_vector_size() { return leg_vector.size(); } |
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.
warning: use of undeclared identifier 'leg_vector' [clang-diagnostic-error]
size_t get_leg_vector_size() { return leg_vector.size(); }
^|
|
||
| size_t get_leg_vector_size() { return leg_vector.size(); } | ||
|
|
||
| leg_info* get_leg_from_leg_vector(size_t i) { return leg_vector[i].get(); } |
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.
warning: use of undeclared identifier 'leg_vector' [clang-diagnostic-error]
leg_info* get_leg_from_leg_vector(size_t i) { return leg_vector[i].get(); }
^| } else if (element.isArray()) { | ||
| const SimdJSONParser::Array& array = element.getArray(); | ||
| bool find = false; | ||
| for (size_t i = 0; i < array.size(); ++i) { |
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.
warning: use range-based for loop instead [modernize-loop-convert]
| for (size_t i = 0; i < array.size(); ++i) { | |
| for (auto child_element : array) { |
be/src/vec/functions/function_jsonb.cpp:1676:
- const SimdJSONParser::Element& child_element = array[i];
- // construct an array cell path leg.
+ // construct an array cell path leg.| return Status::OK(); | ||
| } | ||
|
|
||
| Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
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.
warning: function 'execute_impl' exceeds recommended size/complexity thresholds [readability-function-size]
Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
^Additional context
be/src/vec/functions/function_jsonb.cpp:1827: 120 lines including whitespace and comments (threshold 80)
Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
^| } | ||
| } | ||
|
|
||
| Status FunctionLike::construct_like_const_state(FunctionContext* context, const StringRef& pattern, |
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.
warning: function 'construct_like_const_state' exceeds recommended size/complexity thresholds [readability-function-size]
Status FunctionLike::construct_like_const_state(FunctionContext* context, const StringRef& pattern,
^Additional context
be/src/vec/functions/like.cpp:818: 96 lines including whitespace and comments (threshold 80)
Status FunctionLike::construct_like_const_state(FunctionContext* context, const StringRef& pattern,
^|
run buildall |
7ef7457 to
d144000
Compare
|
run buildall |
|
TeamCity be ut coverage result: |
Like mysql, json_search returns the path which point to a json string
witch match the pattern.
`SELECT JSON_SEARCH('["A",[{"B":"1"}],{"C":"AB"},{"D":"BC"}]', 'one',
'A_') as res;`
```
+----------+
| res |
+----------+
| "$[2].C" |
+----------+
```
d144000 to
36f9479
Compare
|
run buildall |
|
TeamCity be ut coverage result: |
cherry-pick #40948
Like mysql, json_search returns the path which point to a json string witch match the pattern.
SELECT JSON_SEARCH('["A",[{"B":"1"}],{"C":"AB"},{"D":"BC"}]', 'one', 'A_') as res;Proposed changes
Issue Number: close #xxx