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

Function ResolveSymbolLookup

be/src/service/fe-support.cc:307–419  ·  view source on GitHub ↗

Does the symbol resolution, filling in the result in *result.

Source from the content-addressed store, hash-verified

305
306// Does the symbol resolution, filling in the result in *result.
307static void ResolveSymbolLookup(const TSymbolLookupParams params,
308 const vector<ColumnType>& arg_types, TSymbolLookupResult* result) {
309 LibCache::LibType type;
310 if (params.fn_binary_type == TFunctionBinaryType::NATIVE ||
311 params.fn_binary_type == TFunctionBinaryType::BUILTIN) {
312 // We use TYPE_SO for builtins, since LibCache does not resolve symbols for IR
313 // builtins. This is ok since builtins have the same symbol whether we run the IR or
314 // native versions.
315 type = LibCache::TYPE_SO;
316 } else if (params.fn_binary_type == TFunctionBinaryType::IR) {
317 type = LibCache::TYPE_IR;
318 } else if (params.fn_binary_type == TFunctionBinaryType::JAVA) {
319 type = LibCache::TYPE_JAR;
320 } else {
321 DCHECK(false) << params.fn_binary_type;
322 type = LibCache::TYPE_JAR; // Set type to something for the case where DCHECK is off.
323 }
324
325 // Builtin functions are loaded directly from the running process
326 if (params.fn_binary_type != TFunctionBinaryType::BUILTIN) {
327 // Use the latest version of the file from the file system if specified.
328 if (params.needs_refresh) {
329 // Refresh the library if necessary.
330 LibCache::instance()->SetNeedsRefresh(params.location);
331 }
332 LibCacheEntryHandle handle;
333 string dummy_local_path;
334 Status status = LibCache::instance()->GetLocalPath(
335 params.location, type, -1, &handle, &dummy_local_path);
336 if (!status.ok()) {
337 result->__set_result_code(TSymbolLookupResultCode::BINARY_NOT_FOUND);
338 result->__set_error_msg(status.GetDetail());
339 return;
340 }
341 }
342
343 // Check if the FE-specified symbol exists as-is.
344 // Set 'quiet' to true so we don't flood the log with unfound builtin symbols on
345 // startup.
346 time_t mtime = -1;
347 Status status = LibCache::instance()->CheckSymbolExists(
348 params.location, type, params.symbol, true, &mtime);
349 if (status.ok()) {
350 result->__set_result_code(TSymbolLookupResultCode::SYMBOL_FOUND);
351 result->__set_symbol(params.symbol);
352 result->__set_last_modified_time(mtime);
353 return;
354 }
355
356 if (params.fn_binary_type == TFunctionBinaryType::JAVA ||
357 SymbolsUtil::IsMangled(params.symbol)) {
358 // No use trying to mangle Hive or already mangled symbols, return the error.
359 // TODO: we can demangle the user symbol here and validate it against
360 // params.arg_types. This would prevent someone from typing the wrong symbol
361 // by accident. This requires more string parsing of the symbol.
362 result->__set_result_code(TSymbolLookupResultCode::SYMBOL_NOT_FOUND);
363 stringstream ss;
364 ss << "Could not find symbol '" << params.symbol << "' in: " << params.location;

Calls 8

SetNeedsRefreshMethod · 0.80
GetLocalPathMethod · 0.80
GetDetailMethod · 0.80
CheckSymbolExistsMethod · 0.80
okMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected