[pipelineX](fix) Fix BE crash caused by join and constant expr (#24862)
This commit is contained in:
@ -79,8 +79,13 @@ Status VCaseExpr::prepare(RuntimeState* state, const RowDescriptor& desc, VExprC
|
||||
|
||||
Status VCaseExpr::open(RuntimeState* state, VExprContext* context,
|
||||
FunctionContext::FunctionStateScope scope) {
|
||||
RETURN_IF_ERROR(VExpr::open(state, context, scope));
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
RETURN_IF_ERROR(_children[i]->open(state, context, scope));
|
||||
}
|
||||
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
RETURN_IF_ERROR(VExpr::get_const_col(context, nullptr));
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -81,8 +81,13 @@ doris::Status VCastExpr::prepare(doris::RuntimeState* state, const doris::RowDes
|
||||
|
||||
doris::Status VCastExpr::open(doris::RuntimeState* state, VExprContext* context,
|
||||
FunctionContext::FunctionStateScope scope) {
|
||||
RETURN_IF_ERROR(VExpr::open(state, context, scope));
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
RETURN_IF_ERROR(_children[i]->open(state, context, scope));
|
||||
}
|
||||
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
RETURN_IF_ERROR(VExpr::get_const_col(context, nullptr));
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -121,8 +121,13 @@ Status VectorizedFnCall::prepare(RuntimeState* state, const RowDescriptor& desc,
|
||||
|
||||
Status VectorizedFnCall::open(RuntimeState* state, VExprContext* context,
|
||||
FunctionContext::FunctionStateScope scope) {
|
||||
RETURN_IF_ERROR(VExpr::open(state, context, scope));
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
RETURN_IF_ERROR(_children[i]->open(state, context, scope));
|
||||
}
|
||||
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
RETURN_IF_ERROR(VExpr::get_const_col(context, nullptr));
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -201,6 +201,9 @@ Status VExpr::open(RuntimeState* state, VExprContext* context,
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
RETURN_IF_ERROR(_children[i]->open(state, context, scope));
|
||||
}
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
RETURN_IF_ERROR(VExpr::get_const_col(context, nullptr));
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
@ -466,6 +469,7 @@ Status VExpr::get_const_col(VExprContext* context,
|
||||
}
|
||||
|
||||
if (_constant_col != nullptr) {
|
||||
DCHECK(column_wrapper != nullptr);
|
||||
*column_wrapper = _constant_col;
|
||||
return Status::OK();
|
||||
}
|
||||
@ -479,7 +483,10 @@ Status VExpr::get_const_col(VExprContext* context,
|
||||
DCHECK(result != -1);
|
||||
const auto& column = block.get_by_position(result).column;
|
||||
_constant_col = std::make_shared<ColumnPtrWrapper>(column);
|
||||
*column_wrapper = _constant_col;
|
||||
if (column_wrapper != nullptr) {
|
||||
*column_wrapper = _constant_col;
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -78,8 +78,13 @@ Status VInPredicate::prepare(RuntimeState* state, const RowDescriptor& desc,
|
||||
|
||||
Status VInPredicate::open(RuntimeState* state, VExprContext* context,
|
||||
FunctionContext::FunctionStateScope scope) {
|
||||
RETURN_IF_ERROR(VExpr::open(state, context, scope));
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
RETURN_IF_ERROR(_children[i]->open(state, context, scope));
|
||||
}
|
||||
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
RETURN_IF_ERROR(VExpr::get_const_col(context, nullptr));
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -92,11 +92,16 @@ Status VMatchPredicate::prepare(RuntimeState* state, const RowDescriptor& desc,
|
||||
|
||||
Status VMatchPredicate::open(RuntimeState* state, VExprContext* context,
|
||||
FunctionContext::FunctionStateScope scope) {
|
||||
RETURN_IF_ERROR(VExpr::open(state, context, scope));
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
RETURN_IF_ERROR(_children[i]->open(state, context, scope));
|
||||
}
|
||||
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
|
||||
if (scope == FunctionContext::THREAD_LOCAL || scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
context->fn_context(_fn_context_index)->set_function_state(scope, _inverted_index_ctx);
|
||||
}
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
RETURN_IF_ERROR(VExpr::get_const_col(context, nullptr));
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ public:
|
||||
}
|
||||
|
||||
bool use_default_implementation_for_nulls() const override { return true; }
|
||||
bool use_default_implementation_for_constants() const override { return false; }
|
||||
|
||||
Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
|
||||
size_t result, size_t input_rows_count) override {
|
||||
|
||||
Reference in New Issue
Block a user