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

Method SetUp

be/src/exprs/expr-codegen-test.cc:112–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 }
111
112 virtual void SetUp() {
113 TQueryOptions query_options;
114 query_options.__set_disable_codegen(false);
115 query_options.__set_decimal_v2(true);
116 test_env_.reset(new TestEnv());
117 ASSERT_OK(test_env_->Init());
118 ASSERT_OK(test_env_->CreateQueryState(0, &query_options, &runtime_state_));
119 QueryState* qs = runtime_state_->query_state();
120 TPlanFragment* fragment = qs->obj_pool()->Add(new TPlanFragment());
121 PlanFragmentCtxPB* fragment_ctx = qs->obj_pool()->Add(new PlanFragmentCtxPB());
122 fragment_state_ =
123 qs->obj_pool()->Add(new FragmentState(qs, *fragment, *fragment_ctx));
124
125 FunctionContext::TypeDesc return_type;
126 return_type.type = FunctionContext::TYPE_DECIMAL;
127 return_type.precision = RET_PRECISION;
128 return_type.scale = RET_SCALE;
129
130 FunctionContext::TypeDesc arg0_type;
131 arg0_type.type = FunctionContext::TYPE_DECIMAL;
132 arg0_type.precision = ARG0_PRECISION;
133 arg0_type.scale = ARG0_SCALE;
134
135 FunctionContext::TypeDesc arg1_type;
136 arg1_type.type = FunctionContext::TYPE_BOOLEAN;
137
138 FunctionContext::TypeDesc arg2_type;
139 arg2_type.type = FunctionContext::TYPE_STRING;
140
141 vector<FunctionContext::TypeDesc> arg_types;
142 arg_types.push_back(arg0_type);
143 arg_types.push_back(arg1_type);
144 arg_types.push_back(arg2_type);
145
146 fn_ctx_ = UdfTestHarness::CreateTestContext(return_type, arg_types, runtime_state_);
147
148 // Initialize fn_ctx_ with constants
149 memset(&fn_type_attr_, -1, sizeof(FnAttr));
150 fn_ctx_->SetFunctionState(FunctionContext::THREAD_LOCAL, &fn_type_attr_);
151 }
152
153 virtual void TearDown() {
154 fn_ctx_->impl()->Close();

Callers

nothing calls this directly

Calls 8

push_backMethod · 0.80
SetFunctionStateMethod · 0.80
resetMethod · 0.65
InitMethod · 0.45
CreateQueryStateMethod · 0.45
query_stateMethod · 0.45
AddMethod · 0.45
obj_poolMethod · 0.45

Tested by

no test coverage detected