Skip to content

Variant sparse#45492

Merged
eldenmoon merged 3 commits intoapache:variant-sparsefrom
eldenmoon:variant-sparse
Dec 16, 2024
Merged

Variant sparse#45492
eldenmoon merged 3 commits intoapache:variant-sparsefrom
eldenmoon:variant-sparse

Conversation

@eldenmoon
Copy link
Member

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • 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
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@Thearas
Copy link
Contributor

Thearas commented Dec 16, 2024

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@eldenmoon eldenmoon merged commit 824ed73 into apache:variant-sparse Dec 16, 2024
Copy link
Contributor

@github-actions github-actions bot left a 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

return _subcolumn_readers->find_leaf(relative_path);
}

Status VariantColumnReader::new_iterator(ColumnIterator** iterator,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'new_iterator' has cognitive complexity of 51 (threshold 50) [readability-function-cognitive-complexity]

Status VariantColumnReader::new_iterator(ColumnIterator** iterator,
                            ^
Additional context

be/src/olap/rowset/segment_v2/column_reader.cpp:237: +1, including nesting penalty of 0, nesting level increased to 1

    if (node != nullptr) {
    ^

be/src/olap/rowset/segment_v2/column_reader.cpp:238: +2, including nesting penalty of 1, nesting level increased to 2

        if (node->is_leaf_node()) {
        ^

be/src/olap/rowset/segment_v2/column_reader.cpp:242: +3, including nesting penalty of 2, nesting level increased to 3

            RETURN_IF_ERROR(node->data.reader->new_iterator(iterator));
            ^

be/src/common/status.h:632: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/olap/rowset/segment_v2/column_reader.cpp:242: +4, including nesting penalty of 3, nesting level increased to 4

            RETURN_IF_ERROR(node->data.reader->new_iterator(iterator));
            ^

be/src/common/status.h:634: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/olap/rowset/segment_v2/column_reader.cpp:243: +1, nesting level increased to 2

        } else {
          ^

be/src/olap/rowset/segment_v2/column_reader.cpp:247: +3, including nesting penalty of 2, nesting level increased to 3

            if (!_sparse_column_set_in_stats.empty()) {
            ^

be/src/olap/rowset/segment_v2/column_reader.cpp:250: +4, including nesting penalty of 3, nesting level increased to 4

                RETURN_IF_ERROR(_sparse_column_reader->new_iterator(&iter));
                ^

be/src/common/status.h:632: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/olap/rowset/segment_v2/column_reader.cpp:250: +5, including nesting penalty of 4, nesting level increased to 5

                RETURN_IF_ERROR(_sparse_column_reader->new_iterator(&iter));
                ^

be/src/common/status.h:634: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/olap/rowset/segment_v2/column_reader.cpp:255: +3, including nesting penalty of 2, nesting level increased to 3

                    (relative_path == root->path) ? HierarchicalDataReader::ReadType::MERGE_ROOT
                                                  ^

be/src/olap/rowset/segment_v2/column_reader.cpp:257: +3, including nesting penalty of 2, nesting level increased to 3

            RETURN_IF_ERROR(HierarchicalDataReader::create(iterator, relative_path, node, root,
            ^

be/src/common/status.h:632: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/olap/rowset/segment_v2/column_reader.cpp:257: +4, including nesting penalty of 3, nesting level increased to 4

            RETURN_IF_ERROR(HierarchicalDataReader::create(iterator, relative_path, node, root,
            ^

be/src/common/status.h:634: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/olap/rowset/segment_v2/column_reader.cpp:260: +1, nesting level increased to 1

    } else {
      ^

be/src/olap/rowset/segment_v2/column_reader.cpp:261: +2, including nesting penalty of 1, nesting level increased to 2

        if (_sparse_column_set_in_stats.contains(StringRef {relative_path.get_path()}) ||
        ^

be/src/olap/rowset/segment_v2/column_reader.cpp:266: +3, including nesting penalty of 2, nesting level increased to 3

            RETURN_IF_ERROR(_sparse_column_reader->new_iterator(&inner_iter));
            ^

be/src/common/status.h:632: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/olap/rowset/segment_v2/column_reader.cpp:266: +4, including nesting penalty of 3, nesting level increased to 4

            RETURN_IF_ERROR(_sparse_column_reader->new_iterator(&inner_iter));
            ^

be/src/common/status.h:634: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

be/src/olap/rowset/segment_v2/column_reader.cpp:269: +1, nesting level increased to 2

        } else {
          ^

be/src/olap/rowset/segment_v2/column_reader.cpp:272: +3, including nesting penalty of 2, nesting level increased to 3

            RETURN_IF_ERROR(Segment::new_default_iterator(target_col, &iter));
            ^

be/src/common/status.h:632: expanded from macro 'RETURN_IF_ERROR'

    do {                                \
    ^

be/src/olap/rowset/segment_v2/column_reader.cpp:272: +4, including nesting penalty of 3, nesting level increased to 4

            RETURN_IF_ERROR(Segment::new_default_iterator(target_col, &iter));
            ^

be/src/common/status.h:634: expanded from macro 'RETURN_IF_ERROR'

        if (UNLIKELY(!_status_.ok())) { \
        ^

_sparse_column->clear();
}

Status SparseColumnExtractReader::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: pointer parameter 'n' can be pointer to const [readability-non-const-parameter]

Suggested change
Status SparseColumnExtractReader::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
Status SparseColumnExtractReader::next_batch(const size_t* n, vectorized::MutableColumnPtr& dst,

Comment on lines +1841 to +1842
elements[i].first == path_elements.elements[i])
++i;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
elements[i].first == path_elements.elements[i])
++i;
elements[i].first == path_elements.elements[i]) {
++i;
}


/// Check is_first flag in current object.
bool is_first_in_current_object() const {
if (elements.empty()) return root_is_first_flag;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
if (elements.empty()) return root_is_first_flag;
if (elements.empty()) { return root_is_first_flag;
}


/// Set flag is_first = false in current object.
void set_not_first_in_current_object() {
if (elements.empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
if (elements.empty())
if (elements.empty()) {

be/src/vec/columns/column_object.cpp:1855:

-         else
+         } else

Comment on lines +1856 to +1857
else
elements.back().second = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
else
elements.back().second = false;
else {
e
}lements.back().second = false;

bool root_is_first_flag = true;
};

Status ColumnObject::serialize_one_row_to_json_format(int64_t row_num, BufferWritable& output,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'serialize_one_row_to_json_format' exceeds recommended size/complexity thresholds [readability-function-size]

Status ColumnObject::serialize_one_row_to_json_format(int64_t row_num, BufferWritable& output,
                     ^
Additional context

be/src/vec/columns/column_object.cpp:1867: 108 lines including whitespace and comments (threshold 80)

Status ColumnObject::serialize_one_row_to_json_format(int64_t row_num, BufferWritable& output,
                     ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants