This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b2438b076d [Bug](case function) do not crash if prepare failed (#15113)
b2438b076d is described below
commit b2438b076dd9e3705e446c9839c67a735134b909
Author: Gabriel <[email protected]>
AuthorDate: Fri Dec 16 11:02:05 2022 +0800
[Bug](case function) do not crash if prepare failed (#15113)
---
be/src/vec/exprs/vcase_expr.cpp | 12 ------------
be/src/vec/functions/function_case.h | 9 +--------
2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/be/src/vec/exprs/vcase_expr.cpp b/be/src/vec/exprs/vcase_expr.cpp
index d8f067f6b8..a5614333ba 100644
--- a/be/src/vec/exprs/vcase_expr.cpp
+++ b/be/src/vec/exprs/vcase_expr.cpp
@@ -63,23 +63,11 @@ Status VCaseExpr::open(RuntimeState* state, VExprContext*
context,
FunctionContext::FunctionStateScope scope) {
RETURN_IF_ERROR(VExpr::open(state, context, scope));
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
- if (scope == doris_udf::FunctionContext::FRAGMENT_LOCAL) {
- auto* case_state = new CaseState {_data_type};
- context->fn_context(_fn_context_index)
- ->set_function_state(FunctionContext::FRAGMENT_LOCAL,
case_state);
- }
return Status::OK();
}
void VCaseExpr::close(RuntimeState* state, VExprContext* context,
FunctionContext::FunctionStateScope scope) {
- if (scope == doris_udf::FunctionContext::FRAGMENT_LOCAL) {
- auto* case_state = reinterpret_cast<CaseState*>(
- context->fn_context(_fn_context_index)
- ->get_function_state(FunctionContext::FRAGMENT_LOCAL));
- delete case_state;
- }
-
VExpr::close_function_context(context, scope, _function);
VExpr::close(state, context, scope);
}
diff --git a/be/src/vec/functions/function_case.h
b/be/src/vec/functions/function_case.h
index f3961c4eef..5c2b39d7f8 100644
--- a/be/src/vec/functions/function_case.h
+++ b/be/src/vec/functions/function_case.h
@@ -27,10 +27,6 @@
namespace doris::vectorized {
-struct CaseState {
- DataTypePtr result_type = nullptr;
-};
-
template <bool has_case, bool has_else>
struct FunctionCaseName;
@@ -375,10 +371,7 @@ public:
Status execute_impl(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
size_t result, size_t input_rows_count) override {
- auto* case_state = reinterpret_cast<CaseState*>(
- context->get_function_state(FunctionContext::FRAGMENT_LOCAL));
-
- return execute_get_type(case_state->result_type, block, arguments,
result,
+ return execute_get_type(block.get_by_position(result).type, block,
arguments, result,
input_rows_count);
}
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]