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

Method CatalogObjectsUrlCallback

be/src/catalog/catalog-server.cc:1422–1467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1420}
1421
1422void CatalogServer::CatalogObjectsUrlCallback(const Webserver::WebRequest& req,
1423 Document* document) {
1424 const auto& args = req.parsed_args;
1425 Webserver::ArgumentMap::const_iterator object_type_arg = args.find("object_type");
1426 Webserver::ArgumentMap::const_iterator object_name_arg = args.find("object_name");
1427 Webserver::ArgumentMap::const_iterator json_arg = args.find("json");
1428 if (object_type_arg != args.end() && object_name_arg != args.end()) {
1429 TCatalogObjectType::type object_type =
1430 TCatalogObjectTypeFromName(object_type_arg->second);
1431
1432 // Get the object type and name from the topic entry key
1433 TCatalogObject request;
1434 Status status =
1435 TCatalogObjectFromObjectName(object_type, object_name_arg->second, &request);
1436
1437 if (json_arg != args.end()) {
1438 // Get the JSON string from FE since Thrift doesn't have a cpp implementation for
1439 // SimpleJsonProtocol (THRIFT-2476), so we use it's java implementation.
1440 // TODO: switch to use cpp implementation of SimpleJsonProtocol after THRIFT-2476
1441 // is resolved.
1442 string json_str;
1443 if (status.ok()) status = catalog_->GetJsonCatalogObject(request, &json_str);
1444 if (status.ok()) {
1445 Value debug_string(json_str, document->GetAllocator());
1446 document->AddMember("json_string", debug_string, document->GetAllocator());
1447 }
1448 } else {
1449 // Get the object and dump its contents.
1450 TCatalogObject result;
1451 if (status.ok()) status = catalog_->GetCatalogObject(request, &result);
1452 if(status.ok()) {
1453 Value debug_string(
1454 ThriftDebugStringNoThrow(result), document->GetAllocator());
1455 document->AddMember("thrift_string", debug_string, document->GetAllocator());
1456 }
1457 }
1458 if (!status.ok()) {
1459 Value error(status.GetDetail(), document->GetAllocator());
1460 document->AddMember("error", error, document->GetAllocator());
1461 }
1462 } else {
1463 Value error("Please specify values for the object_type and object_name parameters.",
1464 document->GetAllocator());
1465 document->AddMember("error", error, document->GetAllocator());
1466 }
1467}
1468
1469void CatalogServer::OperationUsageUrlCallback(
1470 const Webserver::WebRequest& req, Document* document) {

Callers 1

RegisterWebpagesMethod · 0.95

Calls 10

ThriftDebugStringNoThrowFunction · 0.85
GetJsonCatalogObjectMethod · 0.80
GetDetailMethod · 0.80
findMethod · 0.45
endMethod · 0.45
okMethod · 0.45
AddMemberMethod · 0.45
GetCatalogObjectMethod · 0.45

Tested by

no test coverage detected