MCPcopy Create free account
hub / github.com/apache/impala / OpenEvaluator

Method OpenEvaluator

be/src/exprs/case-expr.cc:48–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48Status CaseExpr::OpenEvaluator(FunctionContext::FunctionStateScope scope,
49 RuntimeState* state, ScalarExprEvaluator* eval) const {
50 RETURN_IF_ERROR(ScalarExpr::OpenEvaluator(scope, state, eval));
51 DCHECK_GE(fn_ctx_idx_, 0);
52 FunctionContext* fn_ctx = eval->fn_context(fn_ctx_idx_);
53 CaseExprState* case_state = fn_ctx->Allocate<CaseExprState>();
54 if (UNLIKELY(case_state == nullptr)) {
55 DCHECK(!fn_ctx->impl()->state()->GetQueryStatus().ok());
56 return fn_ctx->impl()->state()->GetQueryStatus();
57 }
58 fn_ctx->SetFunctionState(FunctionContext::THREAD_LOCAL, case_state);
59
60 const ColumnType& case_val_type = has_case_expr_ ? GetChild(0)->type()
61 : ColumnType(TYPE_BOOLEAN);
62 RETURN_IF_ERROR(AllocateAnyVal(state, eval->expr_perm_pool(), case_val_type,
63 "Could not allocate expression value", &case_state->case_val));
64 const ColumnType& when_val_type =
65 has_case_expr_ ? GetChild(1)->type() : GetChild(0)->type();
66 RETURN_IF_ERROR(AllocateAnyVal(state, eval->expr_perm_pool(), when_val_type,
67 "Could not allocate expression value", &case_state->when_val));
68 return Status::OK();
69}
70
71void CaseExpr::CloseEvaluator(FunctionContext::FunctionStateScope scope,
72 RuntimeState* state, ScalarExprEvaluator* eval) const {

Callers 2

OpenMethod · 0.45
CloneMethod · 0.45

Calls 11

AllocateAnyValFunction · 0.85
OKFunction · 0.85
fn_contextMethod · 0.80
implMethod · 0.80
SetFunctionStateMethod · 0.80
ColumnTypeClass · 0.50
okMethod · 0.45
GetQueryStatusMethod · 0.45
stateMethod · 0.45
typeMethod · 0.45
expr_perm_poolMethod · 0.45

Tested by

no test coverage detected