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

Method SetLookupPrepare

be/src/exprs/in-predicate.h:366–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364
365template <typename T, typename SetType>
366void InPredicate::SetLookupPrepare(
367 FunctionContext* ctx, FunctionContext::FunctionStateScope scope) {
368 if (scope != FunctionContext::FRAGMENT_LOCAL) return;
369
370 SetLookupState<SetType>* state = new SetLookupState<SetType>;
371 state->type = ctx->GetArgType(0);
372 state->contains_null = false;
373 // Collect all values in a vector to use the bulk insert API to avoid N^2 behavior
374 // with flat_set.
375 std::vector<SetType> element_list;
376 element_list.reserve(ctx->GetNumArgs() - 1);
377 for (int i = 1; i < ctx->GetNumArgs(); ++i) {
378 DCHECK(ctx->IsArgConstant(i));
379 T* arg = reinterpret_cast<T*>(ctx->GetConstantArg(i));
380 if (arg->is_null) {
381 state->contains_null = true;
382 } else {
383 element_list.push_back(GetVal<T, SetType>(state->type, *arg));
384 }
385 }
386 state->val_set.insert(element_list.begin(), element_list.end());
387 ctx->SetFunctionState(scope, state);
388}
389
390template <typename SetType>
391void InPredicate::SetLookupClose(

Callers

nothing calls this directly

Calls 10

GetArgTypeMethod · 0.80
reserveMethod · 0.80
GetNumArgsMethod · 0.80
IsArgConstantMethod · 0.80
GetConstantArgMethod · 0.80
push_backMethod · 0.80
SetFunctionStateMethod · 0.80
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected