OmniSciDB  0b528656ed
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 2806 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().

2808  {
2809  const auto& table_name = shared_dict_def.get_foreign_table();
2810  const auto td = cat.getMetadataForTable(table_name);
2811  CHECK(td);
2812  const auto& foreign_col_name = shared_dict_def.get_foreign_column();
2813  return cat.getMetadataForColumn(td->tableId, foreign_col_name);
2814 }
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 3953 of file Catalog.cpp.

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

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

3955  {
3956  rapidjson::Document document;
3957  document.Parse(keyMetainfo.c_str());
3958  CHECK(!document.HasParseError());
3959  CHECK(document.IsArray());
3960  for (auto it = document.Begin(); it != document.End(); ++it) {
3961  const auto& key_with_spec_json = *it;
3962  CHECK(key_with_spec_json.IsObject());
3963  const std::string type = key_with_spec_json["type"].GetString();
3964  const std::string name = key_with_spec_json["name"].GetString();
3965  auto key_with_spec = type + " (" + name + ")";
3966  if (type == "SHARED DICTIONARY") {
3967  shared_dict_column_names.insert(name);
3968  key_with_spec += " REFERENCES ";
3969  const std::string foreign_table = key_with_spec_json["foreign_table"].GetString();
3970  const std::string foreign_column = key_with_spec_json["foreign_column"].GetString();
3971  key_with_spec += foreign_table + "(" + foreign_column + ")";
3972  } else {
3973  CHECK(type == "SHARD KEY");
3974  }
3975  shared_dicts.push_back(key_with_spec);
3976  }
3977 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function: