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
15 changes: 11 additions & 4 deletions be/src/pipeline/exec/operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include "pipeline/local_exchange/local_exchange_source_operator.h"
#include "util/debug_util.h"
#include "util/runtime_profile.h"
#include "util/string_util.h"
#include "vec/exprs/vexpr.h"
#include "vec/exprs/vexpr_context.h"
#include "vec/utils/util.hpp"
Expand Down Expand Up @@ -334,16 +335,22 @@ Status OperatorXBase::get_block_after_projects(RuntimeState* state, vectorized::
return get_block(state, block, eos);
}

bool PipelineXLocalStateBase::reached_limit() const {
return _parent->_limit != -1 && _num_rows_returned >= _parent->_limit;
}

void PipelineXLocalStateBase::reached_limit(vectorized::Block* block, bool* eos) {
if (_parent->_limit != -1 and _num_rows_returned + block->rows() >= _parent->_limit) {
block->set_num_rows(_parent->_limit - _num_rows_returned);
*eos = true;
}

DBUG_EXECUTE_IF("Pipeline::reached_limit_early", {
auto op_name = to_lower(_parent->_op_name);
auto arg_op_name = dp->param<std::string>("op_name");
arg_op_name = to_lower(arg_op_name);

if (op_name == arg_op_name) {
*eos = true;
}
});

if (auto rows = block->rows()) {
_num_rows_returned += rows;
COUNTER_UPDATE(_blocks_returned_counter, 1);
Expand Down
1 change: 0 additions & 1 deletion be/src/pipeline/exec/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ class PipelineXLocalStateBase {
// If use projection, we should clear `_origin_block`.
void clear_origin_block();

[[nodiscard]] bool reached_limit() const;
void reached_limit(vectorized::Block* block, bool* eos);
RuntimeProfile* profile() { return _runtime_profile.get(); }

Expand Down