apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.74k stars 3.28k forks source link

[Bug](exchange) fix exchange of tablet shuffle send block error #44102

Closed zhangstar333 closed 1 day ago

zhangstar333 commented 1 day ago

What problem does this PR solve?

Problem Summary: the _batching_block is same as block which is used for output. and maybe different with input block in some column about nullable type. so if sink this will cause nullable type not equal as origin.

Status VRowDistribution::generate_rows_distribution(
        vectorized::Block& input_block, std::shared_ptr<vectorized::Block>& block,
        int64_t& filtered_rows, bool& has_filtered_rows,
        std::vector<RowPartTabletIds>& row_part_tablet_ids, int64_t& rows_stat_val)
    .......
    // batching block rows which need new partitions. deal together at finish.
    if (!_batching_block) [[unlikely]] {
        std::unique_ptr<Block> tmp_block = block->create_same_struct_block(0);
        _batching_block = MutableBlock::create_unique(std::move(*tmp_block));
    }
void OlapTableBlockConvertor::_convert_to_dest_desc_block(doris::vectorized::Block* block) {
    for (int i = 0; i < _output_tuple_desc->slots().size() && i < block->columns(); ++i) {
        SlotDescriptor* desc = _output_tuple_desc->slots()[i];
        if (desc->is_nullable() != block->get_by_position(i).type->is_nullable()) {
            if (desc->is_nullable()) {
                block->get_by_position(i).type =
                        vectorized::make_nullable(block->get_by_position(i).type);
                block->get_by_position(i).column =
                        vectorized::make_nullable(block->get_by_position(i).column);
            } else {
                block->get_by_position(i).type = assert_cast<const vectorized::DataTypeNullable&>(
                                                         *block->get_by_position(i).type)
                                                         .get_nested_type();
                block->get_by_position(i).column = assert_cast<const vectorized::ColumnNullable&>(
                                                           *block->get_by_position(i).column)
                                                           .get_nested_column_ptr();
            }
        }
    }
}

Release note

None

Check List (For Author)

Check List (For Reviewer who merge this PR)

doris-robot commented 1 day ago

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?
zhangstar333 commented 1 day ago

run buildall

github-actions[bot] commented 1 day ago

clang-tidy review says "All clean, LGTM! :+1:"

doris-robot commented 1 day ago

TeamCity be ut coverage result: Function Coverage: 37.97% (9899/26068) Line Coverage: 29.16% (82730/283663) Region Coverage: 28.30% (42493/150136) Branch Coverage: 24.88% (21546/86610) Coverage Report: http://coverage.selectdb-in.cc/coverage/40a052abbc3948e67d48b18fdbc1b6cafedad583_40a052abbc3948e67d48b18fdbc1b6cafedad583/report/index.html

github-actions[bot] commented 1 day ago

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

github-actions[bot] commented 1 day ago

PR approved by anyone and no changes requested.