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

Method LikePrepareInternal

be/src/exprs/like-predicate.cc:63–80  ·  view source on GitHub ↗

TODO: make class StringValue and StringSearch accept a case-sensitive flag and switch back to using the cheaper Constant<>() functions.

Source from the content-addressed store, hash-verified

61// TODO: make class StringValue and StringSearch accept a case-sensitive flag and
62// switch back to using the cheaper Constant<>() functions.
63void LikePredicate::LikePrepareInternal(FunctionContext* context,
64 FunctionContext::FunctionStateScope scope, bool case_sensitive) {
65 if (scope != FunctionContext::THREAD_LOCAL) return;
66 LikePredicateState* state = new LikePredicateState();
67 context->SetFunctionState(scope, state);
68 state->function_ = LikeFn;
69 state->case_sensitive_ = case_sensitive;
70 if (context->IsArgConstant(1)) {
71 StringVal pattern_val = *reinterpret_cast<StringVal*>(context->GetConstantArg(1));
72 if (pattern_val.is_null) return;
73 StringValue pattern = StringValue::FromStringVal(pattern_val);
74 string pattern_str(pattern.Ptr(), pattern.Len());
75 OptimizeConstantPatternMatch(pattern_str, state);
76 if (state->regex_ && !state->regex_->ok()) {
77 context->SetError(Substitute("Invalid regex: $0", pattern_str).c_str());
78 }
79 }
80}
81
82void LikePredicate::LikeClose(FunctionContext* context,
83 FunctionContext::FunctionStateScope scope) {

Callers

nothing calls this directly

Calls 8

SubstituteFunction · 0.85
SetFunctionStateMethod · 0.80
IsArgConstantMethod · 0.80
GetConstantArgMethod · 0.80
PtrMethod · 0.45
LenMethod · 0.45
okMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected