github-actions[bot] commented on code in PR #24304:
URL: https://github.com/apache/doris/pull/24304#discussion_r1336785129
##########
be/src/runtime/group_commit_mgr.cpp:
##########
@@ -511,6 +511,130 @@
return Status::OK();
}
+Status
GroupCommitMgr::group_commit_stream_load(std::shared_ptr<StreamLoadContext>
ctx) {
+ return _insert_into_thread_pool->submit_func([ctx, this] {
+ Status st = _group_commit_stream_load(ctx);
+ if (!st.ok()) {
+ ctx->promise.set_value(st);
+ }
+ });
+}
+
+Status
GroupCommitMgr::_group_commit_stream_load(std::shared_ptr<StreamLoadContext>
ctx) {
+ auto& fragment_params = ctx->put_result.params;
+ auto& tdesc_tbl = fragment_params.desc_tbl;
+ DCHECK(fragment_params.params.per_node_scan_ranges.size() == 1);
+ DCHECK(fragment_params.params.per_node_scan_ranges.begin()->second.size()
== 1);
+ auto& tscan_range_params =
fragment_params.params.per_node_scan_ranges.begin()->second.at(0);
+ auto& nodes = fragment_params.fragment.plan.nodes;
+ DCHECK(nodes.size() > 0);
+ auto& plan_node = nodes.at(0);
+
+ std::vector<std::shared_ptr<doris::vectorized::FutureBlock>> future_blocks;
+ {
+ std::shared_ptr<LoadBlockQueue> load_block_queue;
+ // 1. FileScanNode consumes data from the pipe.
+ std::unique_ptr<RuntimeState> runtime_state =
RuntimeState::create_unique();
+ TUniqueId load_id;
+ load_id.hi = ctx->id.hi;
+ load_id.lo = ctx->id.lo;
+ TQueryOptions query_options;
+ query_options.query_type = TQueryType::LOAD;
+ TQueryGlobals query_globals;
Review Comment:
warning: variable 'query_globals' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
TQueryGlobals query_globals = 0;
```
##########
be/src/runtime/group_commit_mgr.cpp:
##########
@@ -511,6 +511,130 @@ Status
GroupCommitMgr::_append_row(std::shared_ptr<io::StreamLoadPipe> pipe,
return Status::OK();
}
+Status
GroupCommitMgr::group_commit_stream_load(std::shared_ptr<StreamLoadContext>
ctx) {
+ return _insert_into_thread_pool->submit_func([ctx, this] {
+ Status st = _group_commit_stream_load(ctx);
+ if (!st.ok()) {
+ ctx->promise.set_value(st);
+ }
+ });
+}
+
+Status
GroupCommitMgr::_group_commit_stream_load(std::shared_ptr<StreamLoadContext>
ctx) {
+ auto& fragment_params = ctx->put_result.params;
+ auto& tdesc_tbl = fragment_params.desc_tbl;
+ DCHECK(fragment_params.params.per_node_scan_ranges.size() == 1);
+ DCHECK(fragment_params.params.per_node_scan_ranges.begin()->second.size()
== 1);
+ auto& tscan_range_params =
fragment_params.params.per_node_scan_ranges.begin()->second.at(0);
+ auto& nodes = fragment_params.fragment.plan.nodes;
+ DCHECK(nodes.size() > 0);
+ auto& plan_node = nodes.at(0);
+
+ std::vector<std::shared_ptr<doris::vectorized::FutureBlock>> future_blocks;
Review Comment:
warning: variable 'future_blocks' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::vector<std::shared_ptr<doris::vectorized::FutureBlock>>
future_blocks = 0;
```
##########
be/src/runtime/stream_load/stream_load_context.cpp:
##########
@@ -50,9 +50,14 @@ std::string StreamLoadContext::to_json() const {
writer.Key("Comment");
writer.String(load_comment.c_str());
- writer.Key("TwoPhaseCommit");
- std::string need_two_phase_commit = two_phase_commit ? "true" : "false";
- writer.String(need_two_phase_commit.c_str());
+ if (!group_commit) {
+ writer.Key("TwoPhaseCommit");
+ std::string need_two_phase_commit = two_phase_commit ? "true" :
"false";
Review Comment:
warning: variable 'need_two_phase_commit' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::string need_two_phase_commit = 0 = two_phase_commit ? "true" :
"false";
```
##########
be/src/runtime/group_commit_mgr.cpp:
##########
@@ -511,6 +511,130 @@
return Status::OK();
}
+Status
GroupCommitMgr::group_commit_stream_load(std::shared_ptr<StreamLoadContext>
ctx) {
+ return _insert_into_thread_pool->submit_func([ctx, this] {
+ Status st = _group_commit_stream_load(ctx);
+ if (!st.ok()) {
+ ctx->promise.set_value(st);
+ }
+ });
+}
+
+Status
GroupCommitMgr::_group_commit_stream_load(std::shared_ptr<StreamLoadContext>
ctx) {
+ auto& fragment_params = ctx->put_result.params;
+ auto& tdesc_tbl = fragment_params.desc_tbl;
+ DCHECK(fragment_params.params.per_node_scan_ranges.size() == 1);
+ DCHECK(fragment_params.params.per_node_scan_ranges.begin()->second.size()
== 1);
+ auto& tscan_range_params =
fragment_params.params.per_node_scan_ranges.begin()->second.at(0);
+ auto& nodes = fragment_params.fragment.plan.nodes;
+ DCHECK(nodes.size() > 0);
+ auto& plan_node = nodes.at(0);
+
+ std::vector<std::shared_ptr<doris::vectorized::FutureBlock>> future_blocks;
+ {
+ std::shared_ptr<LoadBlockQueue> load_block_queue;
+ // 1. FileScanNode consumes data from the pipe.
+ std::unique_ptr<RuntimeState> runtime_state =
RuntimeState::create_unique();
+ TUniqueId load_id;
+ load_id.hi = ctx->id.hi;
+ load_id.lo = ctx->id.lo;
+ TQueryOptions query_options;
+ query_options.query_type = TQueryType::LOAD;
+ TQueryGlobals query_globals;
+ runtime_state->init(load_id, query_options, query_globals, _exec_env);
+
runtime_state->set_query_mem_tracker(std::make_shared<MemTrackerLimiter>(
+ MemTrackerLimiter::Type::LOAD, fmt::format("Load#Id={}",
ctx->id.to_string()), -1));
+ DescriptorTbl* desc_tbl = nullptr;
+ RETURN_IF_ERROR(DescriptorTbl::create(runtime_state->obj_pool(),
tdesc_tbl, &desc_tbl));
+ runtime_state->set_desc_tbl(desc_tbl);
+ auto file_scan_node =
+ vectorized::NewFileScanNode(runtime_state->obj_pool(),
plan_node, *desc_tbl);
+ Status status = Status::OK();
+ auto sink = stream_load::GroupCommitBlockSink(
+ runtime_state->obj_pool(), file_scan_node.row_desc(),
+ fragment_params.fragment.output_exprs, &status);
+ std::unique_ptr<int, std::function<void(int*)>>
close_scan_node_func((int*)0x01, [&](int*) {
+ if (load_block_queue != nullptr) {
+ load_block_queue->remove_load_id(load_id);
+ }
+ file_scan_node.close(runtime_state.get());
+ sink.close(runtime_state.get(), status);
+ });
+ RETURN_IF_ERROR(file_scan_node.init(plan_node, runtime_state.get()));
+ RETURN_IF_ERROR(file_scan_node.prepare(runtime_state.get()));
+ std::vector<TScanRangeParams> params_vector;
Review Comment:
warning: variable 'params_vector' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::vector<TScanRangeParams> params_vector = 0;
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]