Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions be/src/runtime/plan_fragment_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Status PlanFragmentExecutor::prepare(const TExecPlanFragmentParams& request,
// set up profile counters
profile()->add_child(_plan->runtime_profile(), true, nullptr);
_rows_produced_counter = ADD_COUNTER(profile(), "RowsProduced", TUnit::UNIT);
_blocks_produced_counter = ADD_COUNTER(profile(), "BlocksProduced", TUnit::UNIT);
_fragment_cpu_timer = ADD_TIMER(profile(), "FragmentCpuTime");

VLOG_NOTICE << "plan_root=\n" << _plan->debug_string();
Expand Down Expand Up @@ -274,35 +275,23 @@ Status PlanFragmentExecutor::open() {
}

Status PlanFragmentExecutor::open_vectorized_internal() {
SCOPED_TIMER(profile()->total_time_counter());
{
SCOPED_CPU_TIMER(_fragment_cpu_timer);
SCOPED_TIMER(profile()->total_time_counter());
RETURN_IF_ERROR(_plan->open(_runtime_state.get()));
RETURN_IF_CANCELLED(_runtime_state);
}
if (_sink == nullptr) {
return Status::OK();
}
{
SCOPED_CPU_TIMER(_fragment_cpu_timer);
if (_sink == nullptr) {
return Status::OK();
}
RETURN_IF_ERROR(_sink->open(runtime_state()));
}

{
auto sink_send_span_guard = Defer {[this]() { this->_sink->end_send_span(); }};
doris::vectorized::Block block;
bool eos = false;

while (!eos) {
RETURN_IF_CANCELLED(_runtime_state);
RETURN_IF_ERROR(get_vectorized_internal(&block, &eos));

{
SCOPED_CPU_TIMER(_fragment_cpu_timer);
RETURN_IF_ERROR(get_vectorized_internal(&block, &eos));
}

SCOPED_TIMER(profile()->total_time_counter());
SCOPED_CPU_TIMER(_fragment_cpu_timer);
// Collect this plan and sub plan statistics, and send to parent plan.
if (_collect_query_statistics_with_every_batch) {
_collect_query_statistics();
Expand All @@ -319,7 +308,6 @@ Status PlanFragmentExecutor::open_vectorized_internal() {
}

{
SCOPED_TIMER(profile()->total_time_counter());
_collect_query_statistics();
Status status;
{
Expand All @@ -339,7 +327,6 @@ Status PlanFragmentExecutor::open_vectorized_internal() {
Status PlanFragmentExecutor::get_vectorized_internal(::doris::vectorized::Block* block, bool* eos) {
while (!_done) {
block->clear_column_data(_plan->row_desc().num_materialized_slots());
SCOPED_TIMER(profile()->total_time_counter());
RETURN_IF_ERROR_AND_CHECK_SPAN(
_plan->get_next_after_projects(
_runtime_state.get(), block, &_done,
Expand All @@ -351,6 +338,8 @@ Status PlanFragmentExecutor::get_vectorized_internal(::doris::vectorized::Block*

if (block->rows() > 0) {
COUNTER_UPDATE(_rows_produced_counter, block->rows());
// Not very sure, if should contain empty block
COUNTER_UPDATE(_blocks_produced_counter, block->rows());
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions be/src/runtime/plan_fragment_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ class PlanFragmentExecutor {
// Number of rows returned by this fragment
RuntimeProfile::Counter* _rows_produced_counter;

// Number of blocks returned by this fragment
RuntimeProfile::Counter* _blocks_produced_counter;

RuntimeProfile::Counter* _fragment_cpu_timer;

// It is shared with BufferControlBlock and will be called in two different
Expand Down