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
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vbitmap_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ doris::Status vectorized::VBitmapPredicate::open(doris::RuntimeState* state,

Status VBitmapPredicate::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
DCHECK_EQ(_children.size(), 1);

ColumnPtr argument_column;
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vbloom_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void VBloomPredicate::close(VExprContext* context, FunctionContext::FunctionStat

Status VBloomPredicate::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
DCHECK_EQ(_children.size(), 1);

ColumnPtr argument_column;
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vcase_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Status VCaseExpr::execute_column(VExprContext* context, const Block* block, size
result_column = get_result_from_const(count);
return Status::OK();
}
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);

size_t rows_count = count;
std::vector<ColumnPtr> when_columns;
Expand Down
6 changes: 2 additions & 4 deletions be/src/vec/exprs/vcast_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ void VCastExpr::close(VExprContext* context, FunctionContext::FunctionStateScope

Status VCastExpr::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col)
<< _open_finished << _getting_const_col << _expr_name;
DCHECK(_open_finished || block == nullptr) << _open_finished << _expr_name;
if (is_const_and_have_executed()) { // const have executed in open function
result_column = get_result_from_const(count);
return Status::OK();
Expand Down Expand Up @@ -147,8 +146,7 @@ DataTypePtr TryCastExpr::original_cast_return_type() const {

Status TryCastExpr::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col)
<< _open_finished << _getting_const_col << _expr_name;
DCHECK(_open_finished || block == nullptr) << _open_finished << _expr_name;
if (is_const_and_have_executed()) { // const have executed in open function
result_column = get_result_from_const(count);
return Status::OK();
Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/exprs/vcolumn_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ class VColumnRef final : public VExpr {

Status execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const override {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
result_column = block->get_by_position(_column_id + _gap).column;
DCHECK_EQ(result_column->size(), count);
return Status::OK();
}

DataTypePtr execute_type(const Block* block) const override {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
return block->get_by_position(_column_id + _gap).type;
}

Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/exprs/vcondition_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Status VectorizedIfExpr::_execute_impl_internal(Block& block, const ColumnNumber

Status VectorizedIfExpr::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col) << debug_string();
DCHECK(_open_finished || block == nullptr) << debug_string();
DCHECK_EQ(_children.size(), 3) << "IF expr must have three children";

ColumnPtr cond_column;
Expand Down Expand Up @@ -487,7 +487,7 @@ Status VectorizedIfExpr::execute_column(VExprContext* context, const Block* bloc

Status VectorizedIfNullExpr::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col) << debug_string();
DCHECK(_open_finished || block == nullptr) << debug_string();
DCHECK_EQ(_children.size(), 2) << "IFNULL expr must have two children";

ColumnPtr first_column;
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vdirect_in_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class VDirectInPredicate final : public VExpr {
private:
Status _do_execute(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column, ColumnPtr* arg_column) const {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);

ColumnPtr argument_column;
RETURN_IF_ERROR(_children[0]->execute_column(context, block, count, argument_column));
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vectorized_fn_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Status VectorizedFnCall::_do_execute(VExprContext* context, const Block* block,
}
}
})
DCHECK(_open_finished || _getting_const_col) << debug_string();
DCHECK(_open_finished || block == nullptr) << debug_string();

Block temp_block;
ColumnNumbers args(_children.size());
Expand Down
16 changes: 3 additions & 13 deletions be/src/vec/exprs/vexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,19 +749,9 @@ Status VExpr::get_const_col(VExprContext* context,
return Status::OK();
}

int result = -1;
Block block;
// If block is empty, some functions will produce no result. So we insert a column with
// single value here.
block.insert({ColumnUInt8::create(1), std::make_shared<DataTypeUInt8>(), ""});

_getting_const_col = true;
RETURN_IF_ERROR(execute(context, &block, &result));
_getting_const_col = false;

DCHECK(result != -1);
const auto& column = block.get_by_position(result).column;
_constant_col = std::make_shared<ColumnPtrWrapper>(column);
ColumnPtr result;
RETURN_IF_ERROR(execute_column(context, nullptr, 1, result));
_constant_col = std::make_shared<ColumnPtrWrapper>(result);
if (column_wrapper != nullptr) {
*column_wrapper = _constant_col;
}
Expand Down
5 changes: 1 addition & 4 deletions be/src/vec/exprs/vexpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class VExpr {
// 'count' indicates the number of rows in the result column returned by this expression.
// In the future this interface will add an additional parameter, Selector, which specifies
// which rows in the block should be evaluated.
// If expr is executing constant expressions, then block should be nullptr.
virtual Status execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const = 0;

Expand Down Expand Up @@ -250,8 +251,6 @@ class VExpr {
static std::string debug_string(const VExprSPtrs& exprs);
static std::string debug_string(const VExprContextSPtrs& ctxs);

void set_getting_const_col(bool val = true) { _getting_const_col = val; }

bool is_and_expr() const { return _fn.name.function_name == "and"; }

const TFunction& fn() const { return _fn; }
Expand Down Expand Up @@ -407,8 +406,6 @@ class VExpr {
// get_const_col()
std::shared_ptr<ColumnPtrWrapper> _constant_col;
bool _prepared = false; // for base class VExpr
bool _getting_const_col =
false; // if true, current execute() is in prepare() (that is, can't check _prepared)
// for concrete classes
bool _prepare_finished = false;
bool _open_finished = false;
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vin_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Status VInPredicate::execute_column(VExprContext* context, const Block* block, s
if (fast_execute(context, result_column)) {
return Status::OK();
}
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);

// This is an optimization. For expressions like colA IN (1, 2, 3, 4),
// where all values inside the IN clause are constants,
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vlambda_function_call_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class VLambdaFunctionCallExpr : public VExpr {

Status execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const override {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
return _lambda_function->execute(context, block, count, result_column, _data_type,
_children);
}
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vlambda_function_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class VLambdaFunctionExpr final : public VExpr {

Status execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const override {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
return get_child(0)->execute_column(context, block, count, result_column);
}

Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exprs/vmatch_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Status VMatchPredicate::evaluate_inverted_index(VExprContext* context, uint32_t

Status VMatchPredicate::execute_column(VExprContext* context, const Block* block, size_t count,
ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
if (fast_execute(context, result_column)) {
return Status::OK();
}
Expand Down
10 changes: 1 addition & 9 deletions be/src/vec/exprs/vruntimefilter_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void VRuntimeFilterWrapper::close(VExprContext* context,

Status VRuntimeFilterWrapper::execute_column(VExprContext* context, const Block* block,
size_t count, ColumnPtr& result_column) const {
DCHECK(_open_finished || _getting_const_col);
DCHECK(_open_finished || block == nullptr);
if (_judge_counter.fetch_sub(1) == 0) {
reset_judge_selectivity();
}
Expand All @@ -99,17 +99,9 @@ Status VRuntimeFilterWrapper::execute_column(VExprContext* context, const Block*
COUNTER_UPDATE(_always_true_filter_rows, size);
return Status::OK();
} else {
if (_getting_const_col) {
_impl->set_getting_const_col(true);
}

ColumnPtr arg_column = nullptr;
RETURN_IF_ERROR(
_impl->execute_runtime_filter(context, block, count, result_column, &arg_column));
if (_getting_const_col) {
_impl->set_getting_const_col(false);
}

// bloom filter will handle null aware inside itself
if (_null_aware && TExprNodeType::BLOOM_PRED != node_type()) {
DCHECK(arg_column);
Expand Down
Loading