yiguolei commented on code in PR #50817:
URL: https://github.com/apache/doris/pull/50817#discussion_r2115457301


##########
be/src/runtime/query_context.cpp:
##########
@@ -381,20 +381,27 @@ void QueryContext::set_pipeline_context(
 }
 
 doris::pipeline::TaskScheduler* QueryContext::get_pipe_exec_scheduler() {
-    if (workload_group()) {
-        if (_task_scheduler) {
-            return _task_scheduler;
-        }
+    if (!_task_scheduler) {
+        throw Exception(Status::InternalError("task_scheduler is null"));
     }
-    return _exec_env->pipeline_task_scheduler();
+    return _task_scheduler;
 }
 
-void QueryContext::set_workload_group(WorkloadGroupPtr& wg) {
-    _resource_ctx->set_workload_group(wg);
-    // Should add query first, then the workload group will not be deleted.
+Status QueryContext::set_workload_group(WorkloadGroupPtr& wg) {
+    // resource_ctx use dummmy wg as default wg.
+    // if user specify a wg, then set it in resource_ctx.
+    if (wg) {
+        _resource_ctx->set_workload_group(wg);
+    }
+
+    // Should add query first, the workload group will not be deleted,
+    // then visit workload group's resource
     // see task_group_manager::delete_workload_group_by_ids
+    RETURN_IF_ERROR(workload_group()->add_resource_ctx(_query_id, 
_resource_ctx));
+
     workload_group()->get_query_scheduler(&_task_scheduler, 
&_scan_task_scheduler,

Review Comment:
   这几个变量有问题。 比如我就是dummy,此时,虽然query context的值就是dummy,但是这些task scheduler 
实际没初始化,结果调用的时候就nullptr了



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

Reply via email to