Skip to content

Commit

Permalink
[minor](runtime state) Removed unnecessary constructors from RuntimeS…
Browse files Browse the repository at this point in the history
…tate. (#45001)

### What problem does this PR solve?

Problem Summary:

Removed unnecessary constructors from RuntimeState
  • Loading branch information
Mryange authored Dec 6, 2024
1 parent aec14e6 commit c966991
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ size_t PartitionedAggSinkOperatorX::revocable_mem_size(RuntimeState* state) cons

Status PartitionedAggSinkLocalState::setup_in_memory_agg_op(RuntimeState* state) {
_runtime_state = RuntimeState::create_unique(
nullptr, state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->query_options(), TQueryGlobals {}, state->exec_env(), state->get_query_ctx());
_runtime_state->set_task_execution_context(state->get_task_execution_context().lock());
_runtime_state->set_be_number(state->be_number());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Status PartitionedAggSourceOperatorX::get_block(RuntimeState* state, vectorized:

Status PartitionedAggLocalState::setup_in_memory_agg_op(RuntimeState* state) {
_runtime_state = RuntimeState::create_unique(
nullptr, state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->query_options(), TQueryGlobals {}, state->exec_env(), state->get_query_ctx());
_runtime_state->set_task_execution_context(state->get_task_execution_context().lock());
_runtime_state->set_be_number(state->be_number());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ Status PartitionedHashJoinProbeOperatorX::_setup_internal_operators(
}

local_state._runtime_state = RuntimeState::create_unique(
nullptr, state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->query_options(), TQueryGlobals {}, state->exec_env(), state->get_query_ctx());

local_state._runtime_state->set_task_execution_context(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ Status PartitionedHashJoinSinkOperatorX::_setup_internal_operator(RuntimeState*
auto& local_state = get_local_state(state);

local_state._shared_state->inner_runtime_state = RuntimeState::create_unique(
nullptr, state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->query_options(), TQueryGlobals {}, state->exec_env(), state->get_query_ctx());
local_state._shared_state->inner_runtime_state->set_task_execution_context(
state->get_task_execution_context().lock());
Expand Down
2 changes: 1 addition & 1 deletion be/src/pipeline/exec/spill_sort_sink_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Status SpillSortSinkLocalState::close(RuntimeState* state, Status execsink_statu

Status SpillSortSinkLocalState::setup_in_memory_sort_op(RuntimeState* state) {
_runtime_state = RuntimeState::create_unique(
nullptr, state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->query_options(), TQueryGlobals {}, state->exec_env(), state->get_query_ctx());
_runtime_state->set_task_execution_context(state->get_task_execution_context().lock());
_runtime_state->set_be_number(state->be_number());
Expand Down
2 changes: 1 addition & 1 deletion be/src/pipeline/exec/spill_sort_source_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Status SpillSortLocalState::_create_intermediate_merger(
}
Status SpillSortLocalState::setup_in_memory_sort_op(RuntimeState* state) {
_runtime_state = RuntimeState::create_unique(
nullptr, state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->fragment_instance_id(), state->query_id(), state->fragment_id(),
state->query_options(), TQueryGlobals {}, state->exec_env(), state->get_query_ctx());
_runtime_state->set_task_execution_context(state->get_task_execution_context().lock());
_runtime_state->set_be_number(state->be_number());
Expand Down
6 changes: 3 additions & 3 deletions be/src/pipeline/pipeline_fragment_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ Status PipelineFragmentContext::_build_pipeline_tasks(const doris::TPipelineFrag
<< print_id(_task_runtime_states[pip_idx][i]->fragment_instance_id()) << " "
<< pipeline->debug_string();
_task_runtime_states[pip_idx][i] = RuntimeState::create_unique(
this, local_params.fragment_instance_id, request.query_id,
request.fragment_id, request.query_options, _query_ctx->query_globals,
_exec_env, _query_ctx.get());
local_params.fragment_instance_id, request.query_id, request.fragment_id,
request.query_options, _query_ctx->query_globals, _exec_env,
_query_ctx.get());
auto& task_runtime_state = _task_runtime_states[pip_idx][i];
_runtime_filter_states[i]->set_state(task_runtime_state.get());
{
Expand Down
31 changes: 0 additions & 31 deletions be/src/runtime/runtime_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,37 +123,6 @@ RuntimeState::RuntimeState(const TUniqueId& instance_id, const TUniqueId& query_
DCHECK(_query_mem_tracker != nullptr && _query_mem_tracker->label() != "Orphan");
}

RuntimeState::RuntimeState(pipeline::PipelineFragmentContext*, const TUniqueId& instance_id,
const TUniqueId& query_id, int32_t fragment_id,
const TQueryOptions& query_options, const TQueryGlobals& query_globals,
ExecEnv* exec_env, QueryContext* ctx)
: _profile("Fragment " + print_id(instance_id)),
_load_channel_profile("<unnamed>"),
_obj_pool(new ObjectPool()),
_unreported_error_idx(0),
_query_id(query_id),
_fragment_id(fragment_id),
_per_fragment_instance_idx(0),
_num_rows_load_total(0),
_num_rows_load_filtered(0),
_num_rows_load_unselected(0),
_num_rows_filtered_in_strict_mode_partial_update(0),
_num_print_error_rows(0),
_num_bytes_load_total(0),
_num_finished_scan_range(0),
_error_row_number(0),
_query_ctx(ctx) {
[[maybe_unused]] auto status = init(instance_id, query_options, query_globals, exec_env);
_query_mem_tracker = ctx->query_mem_tracker;
#ifdef BE_TEST
if (_query_mem_tracker == nullptr) {
init_mem_trackers();
}
#endif
DCHECK(_query_mem_tracker != nullptr && _query_mem_tracker->label() != "Orphan");
DCHECK(status.ok());
}

RuntimeState::RuntimeState(const TUniqueId& query_id, int32_t fragment_id,
const TQueryOptions& query_options, const TQueryGlobals& query_globals,
ExecEnv* exec_env, QueryContext* ctx)
Expand Down
7 changes: 1 addition & 6 deletions be/src/runtime/runtime_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ class RuntimeState {
const TQueryOptions& query_options, const TQueryGlobals& query_globals,
ExecEnv* exec_env, QueryContext* ctx);

// for only use in pipelineX
RuntimeState(pipeline::PipelineFragmentContext*, const TUniqueId& instance_id,
const TUniqueId& query_id, int32 fragment_id, const TQueryOptions& query_options,
const TQueryGlobals& query_globals, ExecEnv* exec_env, QueryContext* ctx);

// Used by pipelineX. This runtime state is only used for setup.
// Used by pipeline. This runtime state is only used for setup.
RuntimeState(const TUniqueId& query_id, int32 fragment_id, const TQueryOptions& query_options,
const TQueryGlobals& query_globals, ExecEnv* exec_env, QueryContext* ctx);

Expand Down

0 comments on commit c966991

Please sign in to comment.