Skip to content

Commit

Permalink
[bugfix](core) child block is shared between operator and node, it sh…
Browse files Browse the repository at this point in the history
…ould be shared ptr related with apache#28106
  • Loading branch information
Doris-Extras committed Dec 7, 2023
1 parent 2330b4b commit 269d6c4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions be/src/pipeline/exec/nested_loop_join_probe_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ OPERATOR_CODE_GENERATOR(NestLoopJoinProbeOperator, StatefulOperator)

Status NestLoopJoinProbeOperator::prepare(doris::RuntimeState* state) {
// just for speed up, the way is dangerous
_child_block.reset(_node->get_left_block());
_child_block = _node->get_left_block();
return StatefulOperator::prepare(state);
}

Status NestLoopJoinProbeOperator::close(doris::RuntimeState* state) {
_child_block.release();
return StatefulOperator::close(state);
}

Expand Down
11 changes: 7 additions & 4 deletions be/src/pipeline/exec/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,14 @@ class StatefulOperator : public StreamingOperator<OperatorBuilderType> {

if (node->need_more_input_data()) {
_child_block->clear_column_data();
RETURN_IF_ERROR(child->get_block(state, _child_block.get(), _child_source_state));
RETURN_IF_ERROR(child->get_block(state, _child_block, _child_source_state));
source_state = _child_source_state;
if (_child_block->rows() == 0 && _child_source_state != SourceState::FINISHED) {
return Status::OK();
}
node->prepare_for_next();
RETURN_IF_ERROR(node->push(state, _child_block.get(),
_child_source_state == SourceState::FINISHED));
RETURN_IF_ERROR(
node->push(state, _child_block, _child_source_state == SourceState::FINISHED));
}

if (!node->need_more_input_data()) {
Expand All @@ -475,7 +475,10 @@ class StatefulOperator : public StreamingOperator<OperatorBuilderType> {
}

protected:
std::unique_ptr<vectorized::Block> _child_block;
// _child_block is owned by execnode, not by this operator, so that it should
// be a shared ptr here. I have already modify it in master branch, it need modify
// many codes, so that it is simple to use raw ptr here.
vectorized::Block* _child_block;
SourceState _child_source_state;
};

Expand Down
3 changes: 1 addition & 2 deletions be/src/pipeline/exec/repeat_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ OPERATOR_CODE_GENERATOR(RepeatOperator, StatefulOperator)

Status RepeatOperator::prepare(doris::RuntimeState* state) {
// just for speed up, the way is dangerous
_child_block.reset(_node->get_child_block());
_child_block = _node->get_child_block();
return StatefulOperator::prepare(state);
}

Status RepeatOperator::close(doris::RuntimeState* state) {
_child_block.release();
return StatefulOperator::close(state);
}

Expand Down
3 changes: 1 addition & 2 deletions be/src/pipeline/exec/table_function_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ OPERATOR_CODE_GENERATOR(TableFunctionOperator, StatefulOperator)

Status TableFunctionOperator::prepare(doris::RuntimeState* state) {
// just for speed up, the way is dangerous
_child_block.reset(_node->get_child_block());
_child_block = _node->get_child_block();
return StatefulOperator::prepare(state);
}

Status TableFunctionOperator::close(doris::RuntimeState* state) {
_child_block.release();
return StatefulOperator::close(state);
}

Expand Down

0 comments on commit 269d6c4

Please sign in to comment.