Gabriel39 commented on code in PR #23750:
URL: https://github.com/apache/doris/pull/23750#discussion_r1314377366


##########
be/src/pipeline/exec/repeat_operator.cpp:
##########
@@ -42,4 +43,239 @@ Status RepeatOperator::close(doris::RuntimeState* state) {
     return StatefulOperator::close(state);
 }
 
+RepeatLocalState::RepeatLocalState(RuntimeState* state, OperatorXBase* parent)
+        : Base(state, parent),
+          _child_block(vectorized::Block::create_unique()),
+          _child_source_state(SourceState::DEPEND_ON_SOURCE),
+          _child_eos(false),
+          _repeat_id_idx(0) {}
+
+Status RepeatLocalState::init(RuntimeState* state, LocalStateInfo& info) {
+    RETURN_IF_ERROR(Base::init(state, info));
+    auto& p = _parent->cast<Parent>();
+    _expr_ctxs.resize(p._expr_ctxs.size());
+    for (size_t i = 0; i < _expr_ctxs.size(); i++) {
+        RETURN_IF_ERROR(p._expr_ctxs[i]->clone(state, _expr_ctxs[i]));
+    }
+    return Status::OK();
+}
+
+Status RepeatLocalState::close(RuntimeState* state) {
+    if (_closed) {
+        return Status::OK();
+    }
+    return Base::close(state);
+}
+
+Status RepeatOperatorX::init(const TPlanNode& tnode, RuntimeState* state) {
+    RETURN_IF_ERROR(OperatorXBase::init(tnode, state));
+    
RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(tnode.repeat_node.exprs, 
_expr_ctxs));
+    return Status::OK();
+}
+
+Status RepeatOperatorX::prepare(RuntimeState* state) {
+    VLOG_CRITICAL << "VRepeatNode::prepare";
+    SCOPED_TIMER(_runtime_profile->total_time_counter());
+
+    RETURN_IF_ERROR(OperatorXBase::prepare(state));
+    _output_tuple_desc = 
state->desc_tbl().get_tuple_descriptor(_output_tuple_id);
+    if (_output_tuple_desc == nullptr) {
+        return Status::InternalError("Failed to get tuple descriptor.");
+    }
+    RETURN_IF_ERROR(vectorized::VExpr::prepare(_expr_ctxs, state, 
_child_x->row_desc()));
+    for (const auto& slot_desc : _output_tuple_desc->slots()) {
+        _output_slots.push_back(slot_desc);
+    }
+
+    return Status::OK();
+}
+
+Status RepeatOperatorX::open(RuntimeState* state) {
+    VLOG_CRITICAL << "VRepeatNode::open";
+    SCOPED_TIMER(_runtime_profile->total_time_counter());
+    RETURN_IF_ERROR(OperatorXBase::open(state));
+    RETURN_IF_ERROR(vectorized::VExpr::open(_expr_ctxs, state));
+    RETURN_IF_ERROR(_child_x->open(state));

Review Comment:
   This is already done in `OperatorXBase::open`



##########
be/src/pipeline/exec/repeat_operator.cpp:
##########
@@ -42,4 +43,239 @@ Status RepeatOperator::close(doris::RuntimeState* state) {
     return StatefulOperator::close(state);
 }
 
+RepeatLocalState::RepeatLocalState(RuntimeState* state, OperatorXBase* parent)
+        : Base(state, parent),
+          _child_block(vectorized::Block::create_unique()),
+          _child_source_state(SourceState::DEPEND_ON_SOURCE),
+          _child_eos(false),
+          _repeat_id_idx(0) {}
+
+Status RepeatLocalState::init(RuntimeState* state, LocalStateInfo& info) {
+    RETURN_IF_ERROR(Base::init(state, info));
+    auto& p = _parent->cast<Parent>();
+    _expr_ctxs.resize(p._expr_ctxs.size());
+    for (size_t i = 0; i < _expr_ctxs.size(); i++) {
+        RETURN_IF_ERROR(p._expr_ctxs[i]->clone(state, _expr_ctxs[i]));
+    }
+    return Status::OK();
+}
+
+Status RepeatLocalState::close(RuntimeState* state) {

Review Comment:
   Do not need to override this function



-- 
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

Reply via email to