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

Method RegexpPrepare

be/src/exprs/string-functions-ir.cc:1047–1062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047void StringFunctions::RegexpPrepare(
1048 FunctionContext* context, FunctionContext::FunctionStateScope scope) {
1049 if (scope != FunctionContext::THREAD_LOCAL) return;
1050 if (!context->IsArgConstant(1)) return;
1051 DCHECK_EQ(context->GetArgType(1)->type, FunctionContext::TYPE_STRING);
1052 StringVal* pattern = reinterpret_cast<StringVal*>(context->GetConstantArg(1));
1053 if (pattern->is_null) return;
1054
1055 string error_str;
1056 re2::RE2* re = CompileRegex(*pattern, &error_str, StringVal::null());
1057 if (re == NULL) {
1058 context->SetError(error_str.c_str());
1059 return;
1060 }
1061 context->SetFunctionState(scope, re);
1062}
1063
1064void StringFunctions::RegexpClose(
1065 FunctionContext* context, FunctionContext::FunctionStateScope scope) {

Callers

nothing calls this directly

Calls 6

CompileRegexFunction · 0.85
IsArgConstantMethod · 0.80
GetArgTypeMethod · 0.80
GetConstantArgMethod · 0.80
SetFunctionStateMethod · 0.80
SetErrorMethod · 0.45

Tested by

no test coverage detected