github-actions[bot] commented on code in PR #27004:
URL: https://github.com/apache/doris/pull/27004#discussion_r1394093456


##########
be/src/pipeline/exec/olap_table_sink_v2_operator.h:
##########
@@ -41,9 +42,76 @@ class OlapTableSinkV2Operator final : public 
DataSinkOperator<OlapTableSinkV2Ope
     bool can_write() override { return true; } // TODO: need use mem_limit
 };
 
-OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
-    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
-}
+class OlapTableSinkV2OperatorX;
+
+class OlapTableSinkV2LocalState final
+        : public AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX> {
+public:
+    using Base = AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX>;
+    using Parent = OlapTableSinkV2OperatorX;
+    ENABLE_FACTORY_CREATOR(OlapTableSinkV2LocalState);
+    OlapTableSinkV2LocalState(DataSinkOperatorXBase* parent, RuntimeState* 
state)
+            : Base(parent, state) {};
+    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
+    Status open(RuntimeState* state) override {

Review Comment:
   warning: method 'open' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status open(RuntimeState* state) override {
   ```
   



##########
be/src/pipeline/exec/olap_table_sink_v2_operator.cpp:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "olap_table_sink_v2_operator.h"
+
+#include "common/status.h"
+
+namespace doris {
+class DataSink;
+} // namespace doris
+
+namespace doris::pipeline {
+
+OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
+    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
+}
+
+Status OlapTableSinkV2LocalState::init(RuntimeState* state, 
LocalSinkStateInfo& info) {
+    RETURN_IF_ERROR(Base::init(state, info));
+    SCOPED_TIMER(exec_time_counter());
+    SCOPED_TIMER(_open_timer);
+    auto& p = _parent->cast<Parent>();
+    RETURN_IF_ERROR(_writer->init_properties(p._pool, p._group_commit));
+    return Status::OK();
+}
+
+Status OlapTableSinkV2LocalState::close(RuntimeState* state, Status 
exec_status) {

Review Comment:
   warning: method 'close' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/pipeline/exec/olap_table_sink_v2_operator.h:61:
   ```diff
   -     Status close(RuntimeState* state, Status exec_status) override;
   +     static Status close(RuntimeState* state, Status exec_status) override;
   ```
   



##########
be/src/pipeline/exec/olap_table_sink_v2_operator.h:
##########
@@ -41,9 +42,76 @@
     bool can_write() override { return true; } // TODO: need use mem_limit
 };
 
-OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
-    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
-}
+class OlapTableSinkV2OperatorX;
+
+class OlapTableSinkV2LocalState final
+        : public AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX> {
+public:
+    using Base = AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX>;
+    using Parent = OlapTableSinkV2OperatorX;
+    ENABLE_FACTORY_CREATOR(OlapTableSinkV2LocalState);
+    OlapTableSinkV2LocalState(DataSinkOperatorXBase* parent, RuntimeState* 
state)
+            : Base(parent, state) {};
+    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
+    Status open(RuntimeState* state) override {
+        SCOPED_TIMER(exec_time_counter());
+        SCOPED_TIMER(_open_timer);
+        return Base::open(state);
+    }
+
+    Status close(RuntimeState* state, Status exec_status) override;
+    friend class OlapTableSinkV2OperatorX;
+
+private:
+    Status _close_status = Status::OK();
+};
+
+class OlapTableSinkV2OperatorX final : public 
DataSinkOperatorX<OlapTableSinkV2LocalState> {
+public:
+    using Base = DataSinkOperatorX<OlapTableSinkV2LocalState>;
+    OlapTableSinkV2OperatorX(ObjectPool* pool, int operator_id, const 
RowDescriptor& row_desc,
+                           const std::vector<TExpr>& t_output_expr, bool 
group_commit)
+            : Base(operator_id, 0),
+              _row_desc(row_desc),
+              _t_output_expr(t_output_expr),
+              _group_commit(group_commit),
+              _pool(pool) {};
+
+    Status init(const TDataSink& thrift_sink) override {
+        RETURN_IF_ERROR(Base::init(thrift_sink));
+        // From the thrift expressions create the real exprs.
+        RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, 
_output_vexpr_ctxs));
+        return Status::OK();
+    }
+
+    Status prepare(RuntimeState* state) override {

Review Comment:
   warning: method 'prepare' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status prepare(RuntimeState* state) override {
   ```
   



##########
be/src/pipeline/exec/olap_table_sink_v2_operator.cpp:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "olap_table_sink_v2_operator.h"
+
+#include "common/status.h"
+
+namespace doris {
+class DataSink;
+} // namespace doris
+
+namespace doris::pipeline {
+
+OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
+    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
+}
+
+Status OlapTableSinkV2LocalState::init(RuntimeState* state, 
LocalSinkStateInfo& info) {

Review Comment:
   warning: method 'init' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/pipeline/exec/olap_table_sink_v2_operator.h:54:
   ```diff
   -     Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
   +     static Status init(RuntimeState* state, LocalSinkStateInfo& info) 
override;
   ```
   



##########
be/src/pipeline/exec/olap_table_sink_v2_operator.h:
##########
@@ -41,9 +42,76 @@
     bool can_write() override { return true; } // TODO: need use mem_limit
 };
 
-OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
-    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
-}
+class OlapTableSinkV2OperatorX;
+
+class OlapTableSinkV2LocalState final
+        : public AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX> {
+public:
+    using Base = AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX>;
+    using Parent = OlapTableSinkV2OperatorX;
+    ENABLE_FACTORY_CREATOR(OlapTableSinkV2LocalState);
+    OlapTableSinkV2LocalState(DataSinkOperatorXBase* parent, RuntimeState* 
state)
+            : Base(parent, state) {};
+    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
+    Status open(RuntimeState* state) override {
+        SCOPED_TIMER(exec_time_counter());
+        SCOPED_TIMER(_open_timer);
+        return Base::open(state);
+    }
+
+    Status close(RuntimeState* state, Status exec_status) override;
+    friend class OlapTableSinkV2OperatorX;
+
+private:
+    Status _close_status = Status::OK();
+};
+
+class OlapTableSinkV2OperatorX final : public 
DataSinkOperatorX<OlapTableSinkV2LocalState> {
+public:
+    using Base = DataSinkOperatorX<OlapTableSinkV2LocalState>;
+    OlapTableSinkV2OperatorX(ObjectPool* pool, int operator_id, const 
RowDescriptor& row_desc,
+                           const std::vector<TExpr>& t_output_expr, bool 
group_commit)
+            : Base(operator_id, 0),
+              _row_desc(row_desc),
+              _t_output_expr(t_output_expr),
+              _group_commit(group_commit),
+              _pool(pool) {};
+
+    Status init(const TDataSink& thrift_sink) override {

Review Comment:
   warning: method 'init' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status init(const TDataSink& thrift_sink) override {
   ```
   



##########
be/src/pipeline/exec/olap_table_sink_v2_operator.h:
##########
@@ -41,9 +42,76 @@
     bool can_write() override { return true; } // TODO: need use mem_limit
 };
 
-OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
-    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
-}
+class OlapTableSinkV2OperatorX;
+
+class OlapTableSinkV2LocalState final
+        : public AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX> {
+public:
+    using Base = AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX>;
+    using Parent = OlapTableSinkV2OperatorX;
+    ENABLE_FACTORY_CREATOR(OlapTableSinkV2LocalState);
+    OlapTableSinkV2LocalState(DataSinkOperatorXBase* parent, RuntimeState* 
state)
+            : Base(parent, state) {};
+    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
+    Status open(RuntimeState* state) override {
+        SCOPED_TIMER(exec_time_counter());
+        SCOPED_TIMER(_open_timer);
+        return Base::open(state);
+    }
+
+    Status close(RuntimeState* state, Status exec_status) override;
+    friend class OlapTableSinkV2OperatorX;
+
+private:
+    Status _close_status = Status::OK();
+};
+
+class OlapTableSinkV2OperatorX final : public 
DataSinkOperatorX<OlapTableSinkV2LocalState> {
+public:
+    using Base = DataSinkOperatorX<OlapTableSinkV2LocalState>;
+    OlapTableSinkV2OperatorX(ObjectPool* pool, int operator_id, const 
RowDescriptor& row_desc,
+                           const std::vector<TExpr>& t_output_expr, bool 
group_commit)
+            : Base(operator_id, 0),
+              _row_desc(row_desc),
+              _t_output_expr(t_output_expr),
+              _group_commit(group_commit),
+              _pool(pool) {};
+
+    Status init(const TDataSink& thrift_sink) override {
+        RETURN_IF_ERROR(Base::init(thrift_sink));
+        // From the thrift expressions create the real exprs.
+        RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, 
_output_vexpr_ctxs));
+        return Status::OK();
+    }
+
+    Status prepare(RuntimeState* state) override {
+        RETURN_IF_ERROR(Base::prepare(state));
+        return vectorized::VExpr::prepare(_output_vexpr_ctxs, state, 
_row_desc);
+    }
+
+    Status open(RuntimeState* state) override {
+        RETURN_IF_ERROR(Base::open(state));
+        return vectorized::VExpr::open(_output_vexpr_ctxs, state);
+    }
+
+    Status sink(RuntimeState* state, vectorized::Block* in_block,

Review Comment:
   warning: method 'sink' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status sink(RuntimeState* state, vectorized::Block* in_block,
   ```
   



##########
be/src/pipeline/exec/olap_table_sink_v2_operator.h:
##########
@@ -41,9 +42,76 @@
     bool can_write() override { return true; } // TODO: need use mem_limit
 };
 
-OperatorPtr OlapTableSinkV2OperatorBuilder::build_operator() {
-    return std::make_shared<OlapTableSinkV2Operator>(this, _sink);
-}
+class OlapTableSinkV2OperatorX;
+
+class OlapTableSinkV2LocalState final
+        : public AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX> {
+public:
+    using Base = AsyncWriterSink<vectorized::VTabletWriterV2, 
OlapTableSinkV2OperatorX>;
+    using Parent = OlapTableSinkV2OperatorX;
+    ENABLE_FACTORY_CREATOR(OlapTableSinkV2LocalState);
+    OlapTableSinkV2LocalState(DataSinkOperatorXBase* parent, RuntimeState* 
state)
+            : Base(parent, state) {};
+    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
+    Status open(RuntimeState* state) override {
+        SCOPED_TIMER(exec_time_counter());
+        SCOPED_TIMER(_open_timer);
+        return Base::open(state);
+    }
+
+    Status close(RuntimeState* state, Status exec_status) override;
+    friend class OlapTableSinkV2OperatorX;
+
+private:
+    Status _close_status = Status::OK();
+};
+
+class OlapTableSinkV2OperatorX final : public 
DataSinkOperatorX<OlapTableSinkV2LocalState> {
+public:
+    using Base = DataSinkOperatorX<OlapTableSinkV2LocalState>;
+    OlapTableSinkV2OperatorX(ObjectPool* pool, int operator_id, const 
RowDescriptor& row_desc,
+                           const std::vector<TExpr>& t_output_expr, bool 
group_commit)
+            : Base(operator_id, 0),
+              _row_desc(row_desc),
+              _t_output_expr(t_output_expr),
+              _group_commit(group_commit),
+              _pool(pool) {};
+
+    Status init(const TDataSink& thrift_sink) override {
+        RETURN_IF_ERROR(Base::init(thrift_sink));
+        // From the thrift expressions create the real exprs.
+        RETURN_IF_ERROR(vectorized::VExpr::create_expr_trees(_t_output_expr, 
_output_vexpr_ctxs));
+        return Status::OK();
+    }
+
+    Status prepare(RuntimeState* state) override {
+        RETURN_IF_ERROR(Base::prepare(state));
+        return vectorized::VExpr::prepare(_output_vexpr_ctxs, state, 
_row_desc);
+    }
+
+    Status open(RuntimeState* state) override {

Review Comment:
   warning: method 'open' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status open(RuntimeState* state) override {
   ```
   



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