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

Method ParseUrlPrepare

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

Source from the content-addressed store, hash-verified

1362}
1363
1364void StringFunctions::ParseUrlPrepare(
1365 FunctionContext* ctx, FunctionContext::FunctionStateScope scope) {
1366 if (scope != FunctionContext::FRAGMENT_LOCAL) return;
1367 if (!ctx->IsArgConstant(1)) return;
1368 DCHECK_EQ(ctx->GetArgType(1)->type, FunctionContext::TYPE_STRING);
1369 StringVal* part = reinterpret_cast<StringVal*>(ctx->GetConstantArg(1));
1370 if (part->is_null) return;
1371 auto url_part = make_unique<UrlParser::UrlPart>(
1372 UrlParser::GetUrlPart(StringValue::FromStringVal(*part)));
1373 if (*url_part == UrlParser::INVALID) {
1374 stringstream ss;
1375 ss << "Invalid URL part: " << AnyValUtil::ToString(*part) << endl
1376 << "(Valid URL parts are 'PROTOCOL', 'HOST', 'PATH', 'REF', 'AUTHORITY', 'FILE', "
1377 << "'USERINFO', and 'QUERY')";
1378 ctx->SetError(ss.str().c_str());
1379 return;
1380 }
1381 ctx->SetFunctionState(scope, url_part.release());
1382}
1383
1384StringVal StringFunctions::ParseUrl(
1385 FunctionContext* ctx, const StringVal& url, const StringVal& part) {

Callers

nothing calls this directly

Calls 8

IsArgConstantMethod · 0.80
GetArgTypeMethod · 0.80
GetConstantArgMethod · 0.80
SetFunctionStateMethod · 0.80
ToStringFunction · 0.50
SetErrorMethod · 0.45
strMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected