OmniSciDB  8a228a1076
Catalog_Namespace::anonymous_namespace{Catalog.cpp} Namespace Reference

Functions

auto table_json_filepath (const std::string &base_path, const std::string &db_name)
 
std::string getUserFromId (const int32_t id)
 
const ColumnDescriptorget_foreign_col (const Catalog &cat, const Parser::SharedDictionaryDef &shared_dict_def)
 
void unserialize_key_metainfo (std::vector< std::string > &shared_dicts, std::set< std::string > &shared_dict_column_names, const std::string keyMetainfo)
 

Function Documentation

◆ get_foreign_col()

const ColumnDescriptor* Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_foreign_col ( const Catalog cat,
const Parser::SharedDictionaryDef shared_dict_def 
)

Definition at line 2822 of file Catalog.cpp.

References CHECK, Parser::SharedDictionaryDef::get_foreign_column(), Parser::SharedDictionaryDef::get_foreign_table(), Catalog_Namespace::Catalog::getMetadataForColumn(), and Catalog_Namespace::Catalog::getMetadataForTable().

Referenced by Catalog_Namespace::Catalog::addReferenceToForeignDict().

2824  {
2825  const auto& table_name = shared_dict_def.get_foreign_table();
2826  const auto td = cat.getMetadataForTable(table_name);
2827  CHECK(td);
2828  const auto& foreign_col_name = shared_dict_def.get_foreign_column();
2829  return cat.getMetadataForColumn(td->tableId, foreign_col_name);
2830 }
std::string cat(Ts &&... args)
const std::string & get_foreign_column() const
Definition: ParserNode.h:901
const std::string & get_foreign_table() const
Definition: ParserNode.h:899
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserFromId()

std::string Catalog_Namespace::anonymous_namespace{Catalog.cpp}::getUserFromId ( const int32_t  id)

Definition at line 916 of file Catalog.cpp.

References Catalog_Namespace::SysCatalog::instance(), and Catalog_Namespace::UserMetadata::userName.

Referenced by Catalog_Namespace::Catalog::buildMaps().

916  {
917  UserMetadata user;
918  if (SysCatalog::instance().getMetadataForUserById(id, user)) {
919  return user.userName;
920  }
921  // a user could be deleted and a dashboard still exist?
922  return "Unknown";
923 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ table_json_filepath()

auto Catalog_Namespace::anonymous_namespace{Catalog.cpp}::table_json_filepath ( const std::string &  base_path,
const std::string &  db_name 
)
inline

Definition at line 152 of file Catalog.cpp.

Referenced by Catalog_Namespace::Catalog::Catalog(), Catalog_Namespace::Catalog::dropTableFromJsonUnlocked(), Catalog_Namespace::Catalog::serializeTableJsonUnlocked(), and Catalog_Namespace::Catalog::~Catalog().

153  {
154  return boost::filesystem::path(base_path + "/mapd_catalogs/" + db_name +
155  "_temp_tables.json");
156 }
+ Here is the caller graph for this function:

◆ unserialize_key_metainfo()

void Catalog_Namespace::anonymous_namespace{Catalog.cpp}::unserialize_key_metainfo ( std::vector< std::string > &  shared_dicts,
std::set< std::string > &  shared_dict_column_names,
const std::string  keyMetainfo 
)

Definition at line 3992 of file Catalog.cpp.

References CHECK, Catalog_Namespace::Catalog::name(), and run_benchmark_import::type.

Referenced by Catalog_Namespace::Catalog::dumpCreateTable().

3994  {
3995  rapidjson::Document document;
3996  document.Parse(keyMetainfo.c_str());
3997  CHECK(!document.HasParseError());
3998  CHECK(document.IsArray());
3999  for (auto it = document.Begin(); it != document.End(); ++it) {
4000  const auto& key_with_spec_json = *it;
4001  CHECK(key_with_spec_json.IsObject());
4002  const std::string type = key_with_spec_json["type"].GetString();
4003  const std::string name = key_with_spec_json["name"].GetString();
4004  auto key_with_spec = type + " (" + name + ")";
4005  if (type == "SHARED DICTIONARY") {
4006  shared_dict_column_names.insert(name);
4007  key_with_spec += " REFERENCES ";
4008  const std::string foreign_table = key_with_spec_json["foreign_table"].GetString();
4009  const std::string foreign_column = key_with_spec_json["foreign_column"].GetString();
4010  key_with_spec += foreign_table + "(" + foreign_column + ")";
4011  } else {
4012  CHECK(type == "SHARD KEY");
4013  }
4014  shared_dicts.push_back(key_with_spec);
4015  }
4016 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function: