You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/06/06 11:40:55 UTC

[GitHub] [incubator-doris] carlvinhust2012 commented on a diff in pull request #9968: [Refactor] Refactor vectorized scan node

carlvinhust2012 commented on code in PR #9968:
URL: https://github.com/apache/incubator-doris/pull/9968#discussion_r890067287


##########
be/src/vec/exec/vbroker_scan_node.cpp:
##########
@@ -26,107 +26,168 @@
 #include "util/runtime_profile.h"
 #include "util/thread.h"
 #include "util/types.h"
+#include "vec/exec/vbroker_scanner.h"
+#include "vec/exec/vjson_scanner.h"
+#include "vec/exec/vorc_scanner.h"
+#include "vec/exec/vparquet_scanner.h"
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
 
 VBrokerScanNode::VBrokerScanNode(ObjectPool* pool, const TPlanNode& tnode,
                                  const DescriptorTbl& descs)
-        : BrokerScanNode(pool, tnode, descs) {
-    _vectorized = true;
+        : ScanNode(pool, tnode, descs),
+          tuple_id_(tnode.broker_scan_node.tuple_id),
+          runtime_state_(nullptr),
+          tuple_desc_(nullptr),
+          num_running_scanners_(0),
+          scan_finished_(false),
+          max_buffered_batches_(32),
+          wait_scanner_timer_(nullptr) {}
+
+Status VBrokerScanNode::init(const TPlanNode& tnode, RuntimeState* state) {
+    RETURN_IF_ERROR(ScanNode::init(tnode, state));
+    auto& broker_scan_node = tnode.broker_scan_node;
+
+    if (broker_scan_node.__isset.pre_filter_exprs) {
+        pre_filter_texprs_ = broker_scan_node.pre_filter_exprs;
+    }
+
+    return Status::OK();
+}
+
+Status VBrokerScanNode::prepare(RuntimeState* state) {
+    VLOG_QUERY << "BrokerScanNode prepare";
+    RETURN_IF_ERROR(ScanNode::prepare(state));
+    SCOPED_SWITCH_TASK_THREAD_LOCAL_MEM_TRACKER(mem_tracker());
+    // get tuple desc
+    runtime_state_ = state;
+    tuple_desc_ = state->desc_tbl().get_tuple_descriptor(tuple_id_);
+    if (tuple_desc_ == nullptr) {
+        std::stringstream ss;
+        ss << "Failed to get tuple descriptor, tuple_id_=" << tuple_id_;
+        return Status::InternalError(ss.str());
+    }
+
+    // Initialize slots map
+    for (auto slot : tuple_desc_->slots()) {
+        auto pair = slots_map_.emplace(slot->col_name(), slot);
+        if (!pair.second) {
+            std::stringstream ss;
+            ss << "Failed to insert slot, col_name=" << slot->col_name();
+            return Status::InternalError(ss.str());
+        }
+    }
+
+    // Profile
+    wait_scanner_timer_ = ADD_TIMER(runtime_profile(), "WaitScannerTime");
+
+    return Status::OK();
+}
+
+Status VBrokerScanNode::open(RuntimeState* state) {
+    SCOPED_TIMER(_runtime_profile->total_time_counter());
+    SCOPED_SWITCH_TASK_THREAD_LOCAL_MEM_TRACKER(mem_tracker());
+    RETURN_IF_ERROR(ExecNode::open(state));
+    RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::OPEN));
+    RETURN_IF_CANCELLED(state);
+
+    RETURN_IF_ERROR(start_scanners());
+
+    return Status::OK();
 }
 
 Status VBrokerScanNode::start_scanners() {
     {
-        std::unique_lock<std::mutex> l(_batch_queue_lock);

Review Comment:
   Is it necessary to change the variable name like this?



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org