OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ddl_utils::alter_column_utils Namespace Reference

Classes

struct  CompareResult
 

Functions

bool compare_sql_type_infos (const SQLTypeInfo &lhs, const SQLTypeInfo &rhs)
 
CompareResult compare_column_descriptors (const ColumnDescriptor *lhs, const ColumnDescriptor *rhs)
 

Function Documentation

CompareResult ddl_utils::alter_column_utils::compare_column_descriptors ( const ColumnDescriptor lhs,
const ColumnDescriptor rhs 
)

Definition at line 52 of file DdlUtils.cpp.

References ColumnDescriptor::chunks, ColumnDescriptor::columnId, ColumnDescriptor::columnName, ColumnDescriptor::columnType, compare_sql_type_infos(), ColumnDescriptor::default_value, ddl_utils::alter_column_utils::CompareResult::defaults_match, ddl_utils::alter_column_utils::CompareResult::exact_match, ColumnDescriptor::isDeletedCol, ColumnDescriptor::isGeoPhyCol, ColumnDescriptor::isSystemCol, ColumnDescriptor::isVirtualCol, ddl_utils::alter_column_utils::CompareResult::remainder_match, run_benchmark_import::result, ColumnDescriptor::sourceName, ddl_utils::alter_column_utils::CompareResult::sql_types_match, ColumnDescriptor::tableId, and ColumnDescriptor::virtualExpr.

Referenced by AlterTableAlterColumnCommand::alterColumns(), Fragmenter_Namespace::InsertOrderFragmenter::alterNonGeoColumnType(), AlterTableAlterColumnCommandRecoveryMgr::checkpoint(), AlterTableAlterColumnCommandRecoveryMgr::cleanupDeleteDictionaries(), AlterTableAlterColumnCommand::collectExpectedCatalogChanges(), anonymous_namespace{DdlCommandExecutor.cpp}::get_alter_column_src_dst_cds(), and AlterTableAlterColumnCommand::prepareColumns().

53  {
54  CompareResult result;
55  result.defaults_match =
56  (!lhs->default_value.has_value() && !rhs->default_value.has_value()) ||
57  (lhs->default_value.has_value() && rhs->default_value.has_value() &&
58  lhs->default_value.value() == rhs->default_value.value());
59  result.sql_types_match = compare_sql_type_infos(lhs->columnType, rhs->columnType);
60  result.remainder_match =
61  lhs->tableId == rhs->tableId && lhs->columnId == rhs->columnId &&
62  lhs->columnName == rhs->columnName && lhs->sourceName == rhs->sourceName &&
63  lhs->chunks == rhs->chunks && lhs->isSystemCol == rhs->isSystemCol &&
64  lhs->isVirtualCol == rhs->isVirtualCol && lhs->virtualExpr == rhs->virtualExpr &&
65  lhs->isDeletedCol == rhs->isDeletedCol && lhs->isGeoPhyCol == rhs->isGeoPhyCol;
66  result.exact_match =
67  result.defaults_match && result.sql_types_match && result.remainder_match;
68  return result;
69 }
std::string virtualExpr
std::string sourceName
std::string chunks
std::optional< std::string > default_value
bool compare_sql_type_infos(const SQLTypeInfo &lhs, const SQLTypeInfo &rhs)
Definition: DdlUtils.cpp:40
SQLTypeInfo columnType
std::string columnName

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ddl_utils::alter_column_utils::compare_sql_type_infos ( const SQLTypeInfo lhs,
const SQLTypeInfo rhs 
)

Definition at line 40 of file DdlUtils.cpp.

References SQLTypeInfo::get_comp_param(), SQLTypeInfo::get_compression(), SQLTypeInfo::get_dimension(), SQLTypeInfo::get_notnull(), SQLTypeInfo::get_scale(), SQLTypeInfo::get_size(), SQLTypeInfo::get_subtype(), SQLTypeInfo::get_type(), kENCODING_DICT, and kENCODING_NONE.

Referenced by compare_column_descriptors().

40  {
41  return lhs.get_type() == rhs.get_type() && lhs.get_subtype() == rhs.get_subtype() &&
42  lhs.get_dimension() == rhs.get_dimension() &&
43  lhs.get_scale() == rhs.get_scale() &&
44  lhs.get_compression() == rhs.get_compression() &&
45  (lhs.get_compression() == kENCODING_NONE ||
46  lhs.get_comp_param() == rhs.get_comp_param() ||
47  (lhs.get_compression() == kENCODING_DICT &&
48  lhs.get_size() == rhs.get_size())) &&
49  lhs.get_notnull() == rhs.get_notnull();
50 }
HOST DEVICE SQLTypes get_subtype() const
Definition: sqltypes.h:392
HOST DEVICE int get_size() const
Definition: sqltypes.h:403
HOST DEVICE int get_scale() const
Definition: sqltypes.h:396
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
HOST DEVICE int get_dimension() const
Definition: sqltypes.h:393
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:402
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:398

+ Here is the call graph for this function:

+ Here is the caller graph for this function: