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

Method ExecLocalCatalogOp

be/src/service/client-request-state.cc:430–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430Status ClientRequestState::ExecLocalCatalogOp(
431 const TCatalogOpRequest& catalog_op) {
432 switch (catalog_op.op_type) {
433 case TCatalogOpType::USE: {
434 lock_guard<mutex> l(session_->lock);
435 session_->database = exec_request().catalog_op_request.use_db_params.db;
436 return Status::OK();
437 }
438 case TCatalogOpType::SHOW_TABLES:
439 case TCatalogOpType::SHOW_VIEWS: {
440 const TShowTablesParams* params = &catalog_op.show_tables_params;
441 // A NULL pattern means match all tables of the specified table types. However,
442 // Thrift string types can't be NULL in C++, so we have to test if it's set rather
443 // than just blindly using the value.
444 const string* table_name_pattern =
445 params->__isset.show_pattern ? &(params->show_pattern) : nullptr;
446 TGetTablesResult table_names;
447 const set<TImpalaTableType::type>& table_types = params->table_types;
448 RETURN_IF_ERROR(frontend_->GetTableNames(params->db, table_name_pattern,
449 &query_ctx_.session, table_types, &table_names));
450 SetResultSet(table_names.tables);
451 return Status::OK();
452 }
453 case TCatalogOpType::SHOW_METADATA_TABLES: {
454 const TShowTablesParams* params = &catalog_op.show_tables_params;
455 // A NULL pattern means match all tables of the specified table types. However,
456 // Thrift string types can't be NULL in C++, so we have to test if it's set rather
457 // than just blindly using the value.
458 const string* metadata_table_name_pattern =
459 params->__isset.show_pattern ? &(params->show_pattern) : nullptr;
460 DCHECK(params->__isset.tbl);
461 const string& table_name = params->tbl;
462 TGetTablesResult table_names;
463 RETURN_IF_ERROR(frontend_->GetMetadataTableNames(params->db, table_name,
464 metadata_table_name_pattern, &query_ctx_.session, &table_names));
465 SetResultSet(table_names.tables);
466 return Status::OK();
467 }
468 case TCatalogOpType::SHOW_DBS: {
469 const TShowDbsParams* params = &catalog_op.show_dbs_params;
470 TGetDbsResult dbs;
471 const string* db_pattern =
472 params->__isset.show_pattern ? (&params->show_pattern) : NULL;
473 RETURN_IF_ERROR(
474 frontend_->GetDbs(db_pattern, &query_ctx_.session, &dbs));
475 vector<string> names, comments;
476 names.reserve(dbs.dbs.size());
477 comments.reserve(dbs.dbs.size());
478 for (const TDatabase& db: dbs.dbs) {
479 names.push_back(db.db_name);
480 comments.push_back(db.metastore_db.description);
481 }
482 SetResultSet(names, comments);
483 return Status::OK();
484 }
485 case TCatalogOpType::SHOW_DATA_SRCS: {
486 const TShowDataSrcsParams* params = &catalog_op.show_data_srcs_params;
487 TGetDataSrcsResult result;

Callers

nothing calls this directly

Calls 15

OKFunction · 0.85
GetMetadataTableNamesMethod · 0.80
reserveMethod · 0.80
push_backMethod · 0.80
GetDataSrcMetadataMethod · 0.80
ShowRolesMethod · 0.80
ShowCurrentGroupsMethod · 0.80
GetTableHistoryMethod · 0.80
resizeMethod · 0.80
DescribeDbMethod · 0.80
DescribeTableMethod · 0.80

Tested by

no test coverage detected