OmniSciDB  94e8789169
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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)
 
int64_t get_next_refresh_time (const foreign_storage::ForeignTable &foreign_table)
 
std::string table_epochs_to_string (const std::vector< TableEpochInfo > &table_epochs)
 
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

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

Definition at line 3106 of file Catalog.cpp.

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

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

3108  {
3109  const auto& table_name = shared_dict_def.get_foreign_table();
3110  const auto td = cat.getMetadataForTable(table_name);
3111  CHECK(td);
3112  const auto& foreign_col_name = shared_dict_def.get_foreign_column();
3113  return cat.getMetadataForColumn(td->tableId, foreign_col_name);
3114 }
std::string cat(Ts &&...args)
const std::string & get_foreign_table() const
Definition: ParserNode.h:903
const std::string & get_foreign_column() const
Definition: ParserNode.h:905
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_next_refresh_time ( const foreign_storage::ForeignTable foreign_table)

Definition at line 2135 of file Catalog.cpp.

References CHECK, foreign_storage::get_next_refresh_time(), foreign_storage::ForeignTable::NULL_REFRESH_TIME, foreign_storage::OptionsContainer::options, foreign_storage::ForeignTable::REFRESH_TIMING_TYPE_KEY, and foreign_storage::ForeignTable::SCHEDULE_REFRESH_TIMING_TYPE.

Referenced by Catalog_Namespace::Catalog::createTable(), and Catalog_Namespace::Catalog::updateForeignTableRefreshTimes().

2135  {
2136  auto timing_type_entry =
2138  CHECK(timing_type_entry != foreign_table.options.end());
2139  if (timing_type_entry->second ==
2141  return foreign_storage::get_next_refresh_time(foreign_table.options);
2142  }
2144 }
int64_t get_next_refresh_time(const std::map< std::string, std::string, std::less<>> &foreign_table_options)
static constexpr const char * REFRESH_TIMING_TYPE_KEY
Definition: ForeignTable.h:52
#define CHECK(condition)
Definition: Logger.h:197
static constexpr int NULL_REFRESH_TIME
Definition: ForeignTable.h:61
static constexpr const char * SCHEDULE_REFRESH_TIMING_TYPE
Definition: ForeignTable.h:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 890 of file Catalog.cpp.

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

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

890  {
891  UserMetadata user;
892  if (SysCatalog::instance().getMetadataForUserById(id, user)) {
893  return user.userName;
894  }
895  // a user could be deleted and a dashboard still exist?
896  return "Unknown";
897 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string Catalog_Namespace::anonymous_namespace{Catalog.cpp}::table_epochs_to_string ( const std::vector< TableEpochInfo > &  table_epochs)

Definition at line 2997 of file Catalog.cpp.

References to_string().

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

2997  {
2998  std::string table_epochs_str{"["};
2999  bool first_entry{true};
3000  for (const auto& table_epoch : table_epochs) {
3001  if (first_entry) {
3002  first_entry = false;
3003  } else {
3004  table_epochs_str += ", ";
3005  }
3006  table_epochs_str += "(table_id: " + std::to_string(table_epoch.table_id) +
3007  ", epoch: " + std::to_string(table_epoch.table_epoch) + ")";
3008  }
3009  table_epochs_str += "]";
3010  return table_epochs_str;
3011 }
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 153 of file Catalog.cpp.

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

154  {
155  return boost::filesystem::path(base_path + "/mapd_catalogs/" + db_name +
156  "_temp_tables.json");
157 }

+ Here is the caller graph for this function:

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 4283 of file Catalog.cpp.

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

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

4285  {
4286  rapidjson::Document document;
4287  document.Parse(keyMetainfo.c_str());
4288  CHECK(!document.HasParseError());
4289  CHECK(document.IsArray());
4290  for (auto it = document.Begin(); it != document.End(); ++it) {
4291  const auto& key_with_spec_json = *it;
4292  CHECK(key_with_spec_json.IsObject());
4293  const std::string type = key_with_spec_json["type"].GetString();
4294  const std::string name = key_with_spec_json["name"].GetString();
4295  auto key_with_spec = type + " (" + name + ")";
4296  if (type == "SHARED DICTIONARY") {
4297  shared_dict_column_names.insert(name);
4298  key_with_spec += " REFERENCES ";
4299  const std::string foreign_table = key_with_spec_json["foreign_table"].GetString();
4300  const std::string foreign_column = key_with_spec_json["foreign_column"].GetString();
4301  key_with_spec += foreign_table + "(" + foreign_column + ")";
4302  } else {
4303  CHECK(type == "SHARD KEY");
4304  }
4305  shared_dicts.push_back(key_with_spec);
4306  }
4307 }
#define CHECK(condition)
Definition: Logger.h:197
string name
Definition: setup.py:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function: