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

Method ReplacePrepare

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

Source from the content-addressed store, hash-verified

477};
478
479void StringFunctions::ReplacePrepare(FunctionContext* context,
480 FunctionContext::FunctionStateScope scope) {
481 if (scope != FunctionContext::FRAGMENT_LOCAL) return;
482 if (!context->IsArgConstant(1)) return;
483 DCHECK_EQ(context->GetArgType(1)->type, FunctionContext::TYPE_STRING);
484 StringVal* pattern = reinterpret_cast<StringVal*>(context->GetConstantArg(1));
485 if (pattern->is_null || pattern->len == 0) return;
486
487 struct ReplaceContext* replace = context->Allocate<ReplaceContext>();
488 if (replace != nullptr) {
489 new(replace) ReplaceContext(pattern);
490 context->SetFunctionState(scope, replace);
491 }
492}
493
494void StringFunctions::ReplaceClose(FunctionContext* context,
495 FunctionContext::FunctionStateScope scope) {

Callers

nothing calls this directly

Calls 4

IsArgConstantMethod · 0.80
GetArgTypeMethod · 0.80
GetConstantArgMethod · 0.80
SetFunctionStateMethod · 0.80

Tested by

no test coverage detected