OmniSciDB
a5dc49c757
|
Namespaces | |
alter_column_utils | |
anonymous_namespace{DdlUtils.cpp} | |
Classes | |
class | SqlType |
class | Encoding |
class | FilePathWhitelist |
class | FilePathBlacklist |
Enumerations | |
enum | DataTransferType { DataTransferType::IMPORT = 1, DataTransferType::EXPORT } |
enum | TableType { TableType::TABLE = 1, TableType::VIEW, TableType::FOREIGN_TABLE } |
Functions | |
void | set_default_encoding (ColumnDescriptor &cd) |
void | validate_and_set_fixed_encoding (ColumnDescriptor &cd, int encoding_size, const SqlType *column_type) |
void | validate_and_set_dictionary_encoding (ColumnDescriptor &cd, int encoding_size) |
void | validate_and_set_none_encoding (ColumnDescriptor &cd) |
void | validate_and_set_sparse_encoding (ColumnDescriptor &cd, int encoding_size) |
void | validate_and_set_compressed_encoding (ColumnDescriptor &cd, int encoding_size) |
void | validate_and_set_date_encoding (ColumnDescriptor &cd, int encoding_size) |
void | validate_and_set_encoding (ColumnDescriptor &cd, const Encoding *encoding, const SqlType *column_type) |
void | validate_and_set_type (ColumnDescriptor &cd, SqlType *column_type) |
void | validate_and_set_array_size (ColumnDescriptor &cd, const SqlType *column_type) |
void | validate_and_set_default_value (ColumnDescriptor &cd, const std::string *default_value, bool not_null) |
void | set_column_descriptor (const std::string &column_name, ColumnDescriptor &cd, SqlType *column_type, const bool not_null, const Encoding *encoding, const std::string *default_value) |
void | set_default_table_attributes (const std::string &table_name, TableDescriptor &td, const int32_t column_count) |
void | validate_non_duplicate_column (const std::string &column_name, std::unordered_set< std::string > &upper_column_names) |
void | validate_non_reserved_keyword (const std::string &column_name) |
void | validate_table_type (const TableDescriptor *td, const TableType expected_table_type, const std::string &command) |
std::string | table_type_enum_to_string (const TableType table_type) |
std::string | get_malformed_config_error_message (const std::string &config_key) |
void | validate_expanded_file_path (const std::string &file_path, const std::vector< std::string > &whitelisted_root_paths) |
std::vector< std::string > | get_expanded_file_paths (const std::string &file_path, const DataTransferType data_transfer_type) |
void | validate_allowed_file_path (const std::string &file_path, const DataTransferType data_transfer_type, const bool allow_wildcards) |
void | set_whitelisted_paths (const std::string &config_key, const std::string &config_value, std::vector< std::string > &whitelisted_paths) |
|
strong |
Enumerator | |
---|---|
IMPORT | |
EXPORT |
Definition at line 80 of file DdlUtils.h.
|
strong |
Enumerator | |
---|---|
TABLE | |
VIEW | |
FOREIGN_TABLE |
Definition at line 107 of file DdlUtils.h.
std::vector<std::string> ddl_utils::get_expanded_file_paths | ( | const std::string & | file_path, |
const DataTransferType | data_transfer_type | ||
) |
Definition at line 798 of file DdlUtils.cpp.
References IMPORT, and shared::local_glob_filter_sort_files().
Referenced by validate_allowed_file_path().
std::string ddl_utils::get_malformed_config_error_message | ( | const std::string & | config_key | ) |
Definition at line 775 of file DdlUtils.cpp.
Referenced by set_whitelisted_paths().
void ddl_utils::set_column_descriptor | ( | const std::string & | column_name, |
ColumnDescriptor & | cd, | ||
SqlType * | column_type, | ||
const bool | not_null, | ||
const Encoding * | encoding, | ||
const std::string * | default_value | ||
) |
Definition at line 698 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, ColumnDescriptor::isSystemCol, ColumnDescriptor::isVirtualCol, SQLTypeInfo::set_notnull(), validate_and_set_array_size(), validate_and_set_default_value(), validate_and_set_encoding(), and validate_and_set_type().
Referenced by Parser::set_column_descriptor(), and CreateForeignTableCommand::setColumnDetails().
void ddl_utils::set_default_encoding | ( | ColumnDescriptor & | cd | ) |
Definition at line 251 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, g_use_date_in_days_default_encoding, SQLTypeInfo::get_output_srid(), SQLTypeInfo::get_precision(), SQLTypeInfo::get_type(), SQLTypeInfo::is_decimal(), SQLTypeInfo::is_geometry(), SQLTypeInfo::is_string(), SQLTypeInfo::is_string_array(), kDATE, kENCODING_DATE_IN_DAYS, kENCODING_DICT, kENCODING_FIXED, kENCODING_GEOINT, kENCODING_NONE, sql_constants::kMaxNumericPrecision, SQLTypeInfo::set_comp_param(), SQLTypeInfo::set_compression(), and to_string().
Referenced by validate_and_set_encoding().
void ddl_utils::set_default_table_attributes | ( | const std::string & | table_name, |
TableDescriptor & | td, | ||
const int32_t | column_count | ||
) |
Definition at line 714 of file DdlUtils.cpp.
References DEFAULT_FRAGMENT_ROWS, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_ROWS, DEFAULT_PAGE_SIZE, TableDescriptor::fragmenter, TableDescriptor::fragPageSize, TableDescriptor::fragType, Fragmenter_Namespace::INSERT_ORDER, TableDescriptor::isView, TableDescriptor::maxChunkSize, TableDescriptor::maxFragRows, TableDescriptor::maxRows, TableDescriptor::nColumns, and TableDescriptor::tableName.
Referenced by Parser::CreateTableStmt::executeDryRun(), and CreateForeignTableCommand::setTableDetails().
void ddl_utils::set_whitelisted_paths | ( | const std::string & | config_key, |
const std::string & | config_value, | ||
std::vector< std::string > & | whitelisted_paths | ||
) |
Definition at line 855 of file DdlUtils.cpp.
References get_malformed_config_error_message(), logger::INFO, LOG, and shared::printContainer().
Referenced by ddl_utils::FilePathWhitelist::initialize().
std::string ddl_utils::table_type_enum_to_string | ( | const TableType | table_type | ) |
void ddl_utils::validate_allowed_file_path | ( | const std::string & | file_path, |
const DataTransferType | data_transfer_type, | ||
const bool | allow_wildcards = false |
||
) |
Validates that the given file path is allowed. Validation entails ensuring that given path is not under a blacklisted root path and path is under a whitelisted path, if whitelisted paths have been configured. Also excludes the use of spaces and punctuation other than: . / _ + - = :
file_path | - file path to validate |
data_transfer_type | - enum indicating whether validation is for an import or export use case |
allow_wildcards | - bool indicating if wildcards are allowed |
Definition at line 822 of file DdlUtils.cpp.
References get_expanded_file_paths(), ddl_utils::FilePathBlacklist::isBlacklistedPath(), and ddl_utils::FilePathWhitelist::validateWhitelistedFilePath().
Referenced by TableArchiver::dumpTable(), Parser::CopyTableStmt::execute(), Parser::ExportQueryStmt::execute(), TableArchiver::restoreTable(), anonymous_namespace{TableArchiver.cpp}::simple_file_cat(), anonymous_namespace{DBHandler.cpp}::validate_import_file_path_if_local(), and foreign_storage::AbstractFileStorageDataWrapper::validateFilePath().
void ddl_utils::validate_and_set_array_size | ( | ColumnDescriptor & | cd, |
const SqlType * | column_type | ||
) |
Definition at line 531 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, ddl_utils::SqlType::get_array_size(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_elem_type(), ddl_utils::SqlType::get_is_array(), SQLTypeInfo::get_size(), SQLTypeInfo::is_string_array(), kENCODING_DICT, SQLTypeInfo::set_fixed_size(), and SQLTypeInfo::set_size().
Referenced by set_column_descriptor().
void ddl_utils::validate_and_set_compressed_encoding | ( | ColumnDescriptor & | cd, |
int | encoding_size | ||
) |
Definition at line 433 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, SQLTypeInfo::get_output_srid(), SQLTypeInfo::is_geometry(), kENCODING_GEOINT, SQLTypeInfo::set_comp_param(), and SQLTypeInfo::set_compression().
Referenced by validate_and_set_encoding().
void ddl_utils::validate_and_set_date_encoding | ( | ColumnDescriptor & | cd, |
int | encoding_size | ||
) |
Definition at line 453 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, SQLTypeInfo::get_subtype(), SQLTypeInfo::get_type(), kARRAY, kDATE, kENCODING_DATE_IN_DAYS, SQLTypeInfo::set_comp_param(), and SQLTypeInfo::set_compression().
Referenced by validate_and_set_encoding().
void ddl_utils::validate_and_set_default_value | ( | ColumnDescriptor & | cd, |
const std::string * | default_value, | ||
bool | not_null | ||
) |
Definition at line 677 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, ColumnDescriptor::default_value, SQLTypeInfo::is_geometry(), to_upper(), and ddl_utils::anonymous_namespace{DdlUtils.cpp}::validate_literal().
Referenced by set_column_descriptor().
void ddl_utils::validate_and_set_dictionary_encoding | ( | ColumnDescriptor & | cd, |
int | encoding_size | ||
) |
Definition at line 379 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, SQLTypeInfo::is_string(), SQLTypeInfo::is_string_array(), kENCODING_DICT, SQLTypeInfo::set_comp_param(), and SQLTypeInfo::set_compression().
Referenced by validate_and_set_encoding().
void ddl_utils::validate_and_set_encoding | ( | ColumnDescriptor & | cd, |
const Encoding * | encoding, | ||
const SqlType * | column_type | ||
) |
Definition at line 472 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, ddl_utils::Encoding::get_encoding_name(), ddl_utils::Encoding::get_encoding_param(), kENCODING_DIFF, kENCODING_RL, SQLTypeInfo::set_comp_param(), SQLTypeInfo::set_compression(), set_default_encoding(), validate_and_set_compressed_encoding(), validate_and_set_date_encoding(), validate_and_set_dictionary_encoding(), validate_and_set_fixed_encoding(), validate_and_set_none_encoding(), and validate_and_set_sparse_encoding().
Referenced by set_column_descriptor().
void ddl_utils::validate_and_set_fixed_encoding | ( | ColumnDescriptor & | cd, |
int | encoding_size, | ||
const SqlType * | column_type | ||
) |
Definition at line 281 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, SQLTypeInfo::get_precision(), SQLTypeInfo::get_subtype(), SQLTypeInfo::get_type(), is_datetime(), SQLTypeInfo::is_high_precision_timestamp(), IS_INTEGER, kARRAY, kBIGINT, kDATE, kDECIMAL, kENCODING_DATE_IN_DAYS, kENCODING_FIXED, kINT, kNUMERIC, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, SQLTypeInfo::set_comp_param(), SQLTypeInfo::set_compression(), ddl_utils::SqlType::to_string(), and run_benchmark_import::type.
Referenced by validate_and_set_encoding().
void ddl_utils::validate_and_set_none_encoding | ( | ColumnDescriptor & | cd | ) |
Definition at line 405 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, SQLTypeInfo::is_geometry(), SQLTypeInfo::is_string(), SQLTypeInfo::is_string_array(), kENCODING_NONE, SQLTypeInfo::set_comp_param(), and SQLTypeInfo::set_compression().
Referenced by validate_and_set_encoding().
void ddl_utils::validate_and_set_sparse_encoding | ( | ColumnDescriptor & | cd, |
int | encoding_size | ||
) |
Definition at line 416 of file DdlUtils.cpp.
References ColumnDescriptor::columnName, ColumnDescriptor::columnType, SQLTypeInfo::get_notnull(), kENCODING_SPARSE, SQLTypeInfo::set_comp_param(), and SQLTypeInfo::set_compression().
Referenced by validate_and_set_encoding().
void ddl_utils::validate_and_set_type | ( | ColumnDescriptor & | cd, |
SqlType * | column_type | ||
) |
Definition at line 508 of file DdlUtils.cpp.
References ddl_utils::SqlType::check_type(), ColumnDescriptor::columnType, ddl_utils::SqlType::get_is_array(), ddl_utils::SqlType::get_param1(), ddl_utils::SqlType::get_param2(), ddl_utils::SqlType::get_type(), IS_GEO, kARRAY, kGEOMETRY, SQLTypeInfo::set_dimension(), SQLTypeInfo::set_input_srid(), SQLTypeInfo::set_output_srid(), SQLTypeInfo::set_scale(), SQLTypeInfo::set_subtype(), and SQLTypeInfo::set_type().
Referenced by set_column_descriptor().
void ddl_utils::validate_expanded_file_path | ( | const std::string & | file_path, |
const std::vector< std::string > & | whitelisted_root_paths | ||
) |
Definition at line 781 of file DdlUtils.cpp.
Referenced by ddl_utils::FilePathWhitelist::validateWhitelistedFilePath().
void ddl_utils::validate_non_duplicate_column | ( | const std::string & | column_name, |
std::unordered_set< std::string > & | upper_column_names | ||
) |
Definition at line 728 of file DdlUtils.cpp.
Referenced by Parser::CreateTableStmt::executeDryRun(), and CreateForeignTableCommand::setColumnDetails().
void ddl_utils::validate_non_reserved_keyword | ( | const std::string & | column_name | ) |
Definition at line 737 of file DdlUtils.cpp.
References reserved_keywords.
Referenced by CreateForeignTableCommand::setColumnDetails().
void ddl_utils::validate_table_type | ( | const TableDescriptor * | td, |
const TableType | expected_table_type, | ||
const std::string & | command | ||
) |
Definition at line 745 of file DdlUtils.cpp.
References StorageType::FOREIGN_TABLE, FOREIGN_TABLE, TableDescriptor::isView, TableDescriptor::storageType, TABLE, TableDescriptor::tableName, and VIEW.
Referenced by AlterTableAlterColumnCommand::alterColumn(), Parser::AddColumnStmt::check_executable(), DropForeignTableCommand::execute(), AlterForeignTableCommand::execute(), Parser::DropTableStmt::execute(), Parser::RenameColumnStmt::execute(), Parser::DropColumnStmt::execute(), and Parser::DropViewStmt::execute().