github-actions[bot] commented on code in PR #34925:
URL: https://github.com/apache/doris/pull/34925#discussion_r1604436165
##########
be/src/vec/common/schema_util.cpp:
##########
@@ -483,25 +477,8 @@ Status get_least_common_schema(const
std::vector<TabletSchemaSPtr>& schemas,
return Status::OK();
}
-Status parse_and_encode_variant_columns(Block& block, const std::vector<int>&
variant_pos,
- const ParseContext& ctx) {
- try {
- // Parse each variant column from raw string column
- RETURN_IF_ERROR(vectorized::schema_util::parse_variant_columns(block,
variant_pos, ctx));
- vectorized::schema_util::finalize_variant_columns(block, variant_pos,
- false /*not ingore
sparse*/);
- RETURN_IF_ERROR(
-
vectorized::schema_util::encode_variant_sparse_subcolumns(block, variant_pos));
- } catch (const doris::Exception& e) {
- // TODO more graceful, max_filter_ratio
- LOG(WARNING) << "encounter execption " << e.to_string();
- return Status::InternalError(e.to_string());
- }
- return Status::OK();
-}
-
-Status parse_variant_columns(Block& block, const std::vector<int>& variant_pos,
- const ParseContext& ctx) {
+Status _parse_variant_columns(Block& block, const std::vector<int>&
variant_pos,
Review Comment:
warning: function '_parse_variant_columns' has cognitive complexity of 59
(threshold 50) [readability-function-cognitive-complexity]
```cpp
Status _parse_variant_columns(Block& block, const std::vector<int>&
variant_pos,
^
```
<details>
<summary>Additional context</summary>
**be/src/vec/common/schema_util.cpp:481:** +1, including nesting penalty of
0, nesting level increased to 1
```cpp
for (int i = 0; i < variant_pos.size(); ++i) {
^
```
**be/src/vec/common/schema_util.cpp:491:** nesting level increased to 2
```cpp
auto encode_rowstore = [&]() {
^
```
**be/src/vec/common/schema_util.cpp:492:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
if (!ctx.record_raw_json_column) {
^
```
**be/src/vec/common/schema_util.cpp:496:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
if (record_raw_string_with_serialization) {
^
```
**be/src/vec/common/schema_util.cpp:499:** +4, including nesting penalty of
3, nesting level increased to 4
```cpp
for (size_t i = 0; i < var->rows(); ++i) {
^
```
**be/src/vec/common/schema_util.cpp:501:** +5, including nesting penalty of
4, nesting level increased to 5
```cpp
RETURN_IF_ERROR(var->serialize_one_row_to_string(i,
&raw_str));
^
```
**be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/common/schema_util.cpp:501:** +6, including nesting penalty of
5, nesting level increased to 6
```cpp
RETURN_IF_ERROR(var->serialize_one_row_to_string(i,
&raw_str));
^
```
**be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/common/schema_util.cpp:505:** +1, nesting level increased to 3
```cpp
} else {
^
```
**be/src/vec/common/schema_util.cpp:515:** +2, including nesting penalty of
1, nesting level increased to 2
```cpp
if (!var.is_scalar_variant()) {
^
```
**be/src/vec/common/schema_util.cpp:518:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(encode_rowstore());
^
```
**be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/common/schema_util.cpp:518:** +4, including nesting penalty of
3, nesting level increased to 4
```cpp
RETURN_IF_ERROR(encode_rowstore());
^
```
**be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/common/schema_util.cpp:523:** +2, including nesting penalty of
1, nesting level increased to 2
```cpp
if (WhichDataType(remove_nullable(var.get_root_type())).is_json()) {
^
```
**be/src/vec/common/schema_util.cpp:526:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(cast_column({var.get_root(),
var.get_root_type(), ""},
^
```
**be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/common/schema_util.cpp:528:** +4, including nesting penalty of
3, nesting level increased to 4
```cpp
?
make_nullable(std::make_shared<DataTypeString>())
^
```
**be/src/vec/common/schema_util.cpp:526:** +4, including nesting penalty of
3, nesting level increased to 4
```cpp
RETURN_IF_ERROR(cast_column({var.get_root(),
var.get_root_type(), ""},
^
```
**be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/common/schema_util.cpp:531:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
if (raw_json_column->is_nullable()) {
^
```
**be/src/vec/common/schema_util.cpp:535:** +1, nesting level increased to 2
```cpp
} else {
^
```
**be/src/vec/common/schema_util.cpp:539:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
? assert_cast<const
ColumnNullable&>(root).get_nested_column_ptr()
^
```
**be/src/vec/common/schema_util.cpp:549:** +2, including nesting penalty of
1, nesting level increased to 2
```cpp
if (is_nullable) {
^
```
**be/src/vec/common/schema_util.cpp:555:** +2, including nesting penalty of
1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(encode_rowstore());
^
```
**be/src/common/status.h:570:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/common/schema_util.cpp:555:** +3, including nesting penalty of
2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(encode_rowstore());
^
```
**be/src/common/status.h:572:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
</details>
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]