github-actions[bot] commented on code in PR #33904: URL: https://github.com/apache/doris/pull/33904#discussion_r1573134705
########## be/src/vec/exprs/table_function/vexplode_json_array.cpp: ########## @@ -40,25 +43,23 @@ std::string ParsedData::false_value = "false"; auto max_value = std::numeric_limits<int64_t>::max(); //9223372036854775807 auto min_value = std::numeric_limits<int64_t>::min(); //-9223372036854775808 -int ParsedData::set_output(ExplodeJsonArrayType type, rapidjson::Document& document) { +int ParsedData::set_output(rapidjson::Document& document) { Review Comment: warning: function 'set_output' exceeds recommended size/complexity thresholds [readability-function-size] ```cpp int ParsedData::set_output(rapidjson::Document& document) { ^ ``` <details> <summary>Additional context</summary> **be/src/vec/exprs/table_function/vexplode_json_array.cpp:45:** 136 lines including whitespace and comments (threshold 80) ```cpp int ParsedData::set_output(rapidjson::Document& document) { ^ ``` </details> ########## be/src/vec/exprs/table_function/vexplode_json_array.cpp: ########## @@ -118,66 +120,115 @@ wbytes = snprintf(tmp_buf, sizeof(tmp_buf), "%f", v.GetDouble()); } _backup_string.emplace_back(tmp_buf, wbytes); - _string_nulls.push_back(false); + _values_null_flag.emplace_back(false); // do not set _data_string here. // Because the address of the string stored in `_backup_string` may // change each time `emplace_back()` is called. break; + } case rapidjson::Type::kFalseType: _backup_string.emplace_back(true_value); - _string_nulls.push_back(false); + _values_null_flag.emplace_back(false); break; case rapidjson::Type::kTrueType: _backup_string.emplace_back(false_value); - _string_nulls.push_back(false); + _values_null_flag.emplace_back(false); break; case rapidjson::Type::kNullType: _backup_string.emplace_back(); - _string_nulls.push_back(true); + _values_null_flag.emplace_back(true); break; default: _backup_string.emplace_back(); - _string_nulls.push_back(true); + _values_null_flag.emplace_back(true); break; } } // Must set _data_string at the end, so that we can // save the real addr of string in `_backup_string` to `_data_string`. for (auto& str : _backup_string) { - _data_string.emplace_back(str); + _data_string_ref.emplace_back(str.data(), str.length()); } break; } case ExplodeJsonArrayType::JSON: { - _data_string.clear(); + _data_string_ref.clear(); _backup_string.clear(); - _string_nulls.clear(); + _values_null_flag.clear(); for (auto& v : document.GetArray()) { if (v.IsObject()) { rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); v.Accept(writer); _backup_string.emplace_back(buffer.GetString(), buffer.GetSize()); - _string_nulls.push_back(false); + _values_null_flag.emplace_back(false); } else { - _data_string.push_back({}); - _string_nulls.push_back(true); + _backup_string.emplace_back(); + _values_null_flag.emplace_back(true); } } // Must set _data_string at the end, so that we can // save the real addr of string in `_backup_string` to `_data_string`. for (auto& str : _backup_string) { - _data_string.emplace_back(str); + _data_string_ref.emplace_back(str); } break; } default: - CHECK(false) << type; + CHECK(false) << _data_type; break; } return size; } +Status ParsedData::insert_result_from_parsed_data(MutableColumnPtr& column, int max_step, Review Comment: warning: method 'insert_result_from_parsed_data' can be made const [readability-make-member-function-const] be/src/vec/exprs/table_function/vexplode_json_array.cpp:184: ```diff - int64_t cur_offset) { + int64_t cur_offset) const { ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org