diff --git a/storage/tianmu/async_tests/task_executor.h b/storage/tianmu/async_tests/task_executor.h index c30ede7ad..1753286cc 100644 --- a/storage/tianmu/async_tests/task_executor.h +++ b/storage/tianmu/async_tests/task_executor.h @@ -66,7 +66,7 @@ class TaskExecutor { auto task = std::make_unique>(std::move(func)); auto ret = task->get_future(); AddTask(std::move(task)); - return std::move(ret); + return ret; } void Exit(); diff --git a/storage/tianmu/base/core/iostream_impl.h b/storage/tianmu/base/core/iostream_impl.h index 03736013b..8f8759ec1 100644 --- a/storage/tianmu/base/core/iostream_impl.h +++ b/storage/tianmu/base/core/iostream_impl.h @@ -35,7 +35,7 @@ inline future> data_source_impl::skip(uint64_t n) { return get().then([&](temporary_buffer buffer) -> std::experimental::optional> { if (buffer.size() >= n) { buffer.trim_front(n); - return std::move(buffer); + return buffer; } n -= buffer.size(); return {}; diff --git a/storage/tianmu/common/exception.h b/storage/tianmu/common/exception.h index 84edccee7..cd7c82188 100644 --- a/storage/tianmu/common/exception.h +++ b/storage/tianmu/common/exception.h @@ -67,6 +67,7 @@ class TianmuError { TianmuError(ErrorCode tianmu_error_code = ErrorCode::SUCCESS) : ec_(tianmu_error_code) {} TianmuError(ErrorCode tianmu_error_code, std::string message) : ec_(tianmu_error_code), message_(message) {} TianmuError(const TianmuError &tianmu_e) : ec_(tianmu_e.ec_), message_(tianmu_e.message_) {} + TianmuError &operator=(const TianmuError &) = default; operator ErrorCode() { return ec_; } ErrorCode GetErrorCode() { return ec_; } bool operator==(ErrorCode tianmu_ec) { return tianmu_ec == ec_; } diff --git a/storage/tianmu/compress/part_dict.cpp b/storage/tianmu/compress/part_dict.cpp index 7ccf331a3..d7508d45a 100644 --- a/storage/tianmu/compress/part_dict.cpp +++ b/storage/tianmu/compress/part_dict.cpp @@ -107,10 +107,12 @@ void PartDict::Create(DataSet *dataset) { template int PartDict::compare(const void *p1, const void *p2) { - using AK = struct PartDict::HashTab::AKey; - if (((*(AK **)p1)->count) < ((*(AK **)p2)->count)) + using AK = typename PartDict::HashTab::AKey; + if ((*reinterpret_cast(const_cast(p1)))->count < + (*reinterpret_cast(const_cast(p2)))->count) return 1; - else if (((*(AK **)p1)->count) > ((*(AK **)p2)->count)) + else if ((*reinterpret_cast(const_cast(p1)))->count > + (*reinterpret_cast(const_cast(p2)))->count) return -1; else return 0; diff --git a/storage/tianmu/compress/text_compressor.cpp b/storage/tianmu/compress/text_compressor.cpp index 19bad70b5..e2ae108de 100644 --- a/storage/tianmu/compress/text_compressor.cpp +++ b/storage/tianmu/compress/text_compressor.cpp @@ -403,7 +403,7 @@ CprsErr TextCompressor::CompressVer4(char *dest, int &dlen, char **index, const } pos += 4; // store size of encoded data - const int cmpBytes = LZ4_compress(srcdata.get(), dest + pos, length); + const int cmpBytes = LZ4_compress_default(srcdata.get(), dest + pos, length, dlen - pos); if (cmpBytes <= 0 || cmpBytes > dlen - pos) { TIANMU_LOG(LogCtl_Level::ERROR, "CompressVer4 error,cmpBytes: %d dlen - pos = %d", cmpBytes, dlen - pos); @@ -451,7 +451,7 @@ CprsErr TextCompressor::CompressZlib(char *dest, int &dlen, char **index, const uint64_t destlen = dlen - pos; int ret = compress2(reinterpret_cast(dest + pos), &destlen, srcdata.get(), srclen, Z_DEFAULT_COMPRESSION); if (ret != Z_OK) { - TIANMU_LOG(LogCtl_Level::ERROR, "compress2 failure %d, destlen: %d, srclen %d, packlen %u", ret, destlen, srclen, + TIANMU_LOG(LogCtl_Level::ERROR, "compress2 failure %d, destlen: %lu, srclen %lu, packlen %u", ret, destlen, srclen, packlen); return CprsErr::CPRS_ERR_OTH; } @@ -470,7 +470,7 @@ CprsErr TextCompressor::DecompressZlib(char *dest, int dlen, char *src, int slen const int ret = uncompress(reinterpret_cast(dest), &destlen, reinterpret_cast(src + spos), srclen); if (ret != Z_OK) { - TIANMU_LOG(LogCtl_Level::ERROR, "uncompress error: %d, srclen: %d destlen = %d", ret, srclen, dlen); + TIANMU_LOG(LogCtl_Level::ERROR, "uncompress error: %d, srclen: %lu destlen = %d", ret, srclen, dlen); return CprsErr::CPRS_ERR_OTH; } size_t sumlen = 0; diff --git a/storage/tianmu/core/aggregation_algorithm.cpp b/storage/tianmu/core/aggregation_algorithm.cpp index fec171ee8..0e7c66f04 100644 --- a/storage/tianmu/core/aggregation_algorithm.cpp +++ b/storage/tianmu/core/aggregation_algorithm.cpp @@ -855,9 +855,9 @@ void AggregationAlgorithm::TaskFillOutput(GroupByWrapper *gbw, Transaction *ci, } } -void AggregationWorkerEnt::TaskAggrePacks(MIIterator *taskIterator, [[maybe_unused]] DimensionVector *dims, - [[maybe_unused]] MIIterator *mit, [[maybe_unused]] CTask *task, - GroupByWrapper *gbw, Transaction *ci) { +void AggregationWorkerEnt::TaskAggrePacks(MIIterator *taskIterator, DimensionVector *dims [[maybe_unused]], + MIIterator *mit [[maybe_unused]], CTask *task [[maybe_unused]], + GroupByWrapper *gbw, Transaction *ci [[maybe_unused]]) { taskIterator->Rewind(); int task_pack_num = 0; while (taskIterator->IsValid()) { @@ -918,7 +918,6 @@ void AggregationWorkerEnt::DistributeAggreTaskAverage(MIIterator &mit) { pack2cur.emplace(std::pair(packnum, curtuple_index)); int loopcnt = (packnum < m_threads) ? packnum : m_threads; - int mod = packnum % loopcnt; int num = packnum / loopcnt; utils::result_set res; diff --git a/storage/tianmu/core/column.h b/storage/tianmu/core/column.h index 202aff32c..134592353 100644 --- a/storage/tianmu/core/column.h +++ b/storage/tianmu/core/column.h @@ -37,7 +37,7 @@ class Column { if (this != &c) *this = c; } - + constexpr Column &operator=(const Column &) = default; inline const ColumnType &Type() const { return ct; } inline common::CT TypeName() const { return ct.GetTypeName(); } inline void SetTypeName(common::CT type) { ct.SetTypeName(type); } diff --git a/storage/tianmu/core/item_tianmu_field.cpp b/storage/tianmu/core/item_tianmu_field.cpp index 6fbaa07d8..b7aee025d 100644 --- a/storage/tianmu/core/item_tianmu_field.cpp +++ b/storage/tianmu/core/item_tianmu_field.cpp @@ -207,7 +207,6 @@ bool Item_tianmufield::get_timeval(struct timeval *tm, int *warnings) { bool Item_tianmufield::operator==(Item_tianmufield const &o) const { return (varID == o.varID); } type_conversion_status Item_tianmufield::save_in_field_inner(Field *to, bool no_conversions) { - type_conversion_status res; if ((null_value = buf->null)) { null_value = 1; return set_field_to_null_with_conversions(to, no_conversions); diff --git a/storage/tianmu/core/joiner.cpp b/storage/tianmu/core/joiner.cpp index e4c699861..70787e16c 100644 --- a/storage/tianmu/core/joiner.cpp +++ b/storage/tianmu/core/joiner.cpp @@ -40,7 +40,7 @@ TwoDimensionalJoiner::~TwoDimensionalJoiner() { } JoinAlgType TwoDimensionalJoiner::ChooseJoinAlgorithm([[maybe_unused]] MultiIndex &mind, Condition &cond) { - auto choose_map_or_hash = ([&tianmu_sysvar_force_hashjoin, &cond] { + auto choose_map_or_hash = ([&cond] { { // do not use multithreaded hash join in case sp field JoinAlgType join_type = JoinAlgType::JTYPE_NONE; diff --git a/storage/tianmu/core/joiner_general.cpp b/storage/tianmu/core/joiner_general.cpp index b99ac553e..ca2533955 100644 --- a/storage/tianmu/core/joiner_general.cpp +++ b/storage/tianmu/core/joiner_general.cpp @@ -65,8 +65,6 @@ void JoinerGeneral::ExecuteJoinConditions(Condition &cond) { new_mind.Init(approx_size); // an initial size of IndexTable int64_t tuples_in_output = 0; - bool loc_result; - bool stop_execution = false; // early stop for LIMIT // The main loop for checking conditions @@ -99,8 +97,9 @@ void JoinerGeneral::ExecuteJoinConditions(Condition &cond) { // Handles each row in the Pack that the current iterator points to // TODO: Keep in mind that internal Pack reads will have cache invalidation during multithread switching, // leaving the second phase to continue processing the split of the house storage layer -void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, CTask *task, Condition *cond, MINewContents *new_mind, - DimensionVector *all_dims, std::vector *_pack_desc_locked, +void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, CTask *task [[maybe_unused]], Condition *cond, + MINewContents *new_mind, DimensionVector *all_dims, + std::vector *_pack_desc_locked [[maybe_unused]], int64_t *tuples_in_output, int64_t limit, bool count_only, bool *stop_execution, int64_t *rows_passed, int64_t *rows_omitted) { std::scoped_lock guard(mtx); @@ -173,7 +172,8 @@ void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, CTask *task, Condit // The purpose of this function is to process the split task in a separate thread void JoinerGeneral::TaskInnerJoinPacks(MIIterator *taskIterator, CTask *task, Condition *cond, MINewContents *new_mind, - DimensionVector *all_dims, std::vector *pack_desc_locked_p, + DimensionVector *all_dims, + std::vector *pack_desc_locked_p [[maybe_unused]], int64_t *tuples_in_output, int64_t limit, bool count_only, bool *stop_execution, int64_t *rows_passed, int64_t *rows_omitted) { int no_desc = (*cond).Size(); @@ -279,7 +279,7 @@ void JoinerGeneral::ExecuteInnerJoinLoopMultiThread(MIIterator &mit, Condition & int packnum = 0; while (mit.IsValid()) { - int64_t packrow_length = mit.GetPackSizeLeft(); + int64_t packrow_length [[maybe_unused]] = mit.GetPackSizeLeft(); packnum++; mit.NextPackrow(); } @@ -333,9 +333,7 @@ void JoinerGeneral::ExecuteInnerJoinLoopMultiThread(MIIterator &mit, Condition & int64_t rows_passed = 0; int64_t rows_omitted = 0; - int no_desc = cond.Size(); bool stop_execution = false; - int index = 0; mit.Rewind(); diff --git a/storage/tianmu/core/joiner_mapped.cpp b/storage/tianmu/core/joiner_mapped.cpp index 0b2994da8..277fa37da 100644 --- a/storage/tianmu/core/joiner_mapped.cpp +++ b/storage/tianmu/core/joiner_mapped.cpp @@ -218,7 +218,7 @@ std::unique_ptr JoinerMapped::GenerateFunction(vcolumn::Virtu rc_control_.lock(m_conn->GetThreadID()) << "Join mapping (multimaps) created on " << mit.NumOfTuples() << " rows." << system::unlock; - return std::move(map_function); + return map_function; } int64_t JoinerParallelMapped::ExecuteMatchLoop(std::shared_ptr *indextable, diff --git a/storage/tianmu/core/mi_iterator.h b/storage/tianmu/core/mi_iterator.h index afaa09f08..28fbff95b 100644 --- a/storage/tianmu/core/mi_iterator.h +++ b/storage/tianmu/core/mi_iterator.h @@ -351,6 +351,7 @@ class MIInpackIterator : public MIIterator { public: MIInpackIterator(const MIIterator &sec) : MIIterator(sec) {} MIInpackIterator() : MIIterator() {} + MIInpackIterator(const MIInpackIterator &) = default; void swap(MIInpackIterator &i); MIInpackIterator &operator=(const MIInpackIterator &m) { MIInpackIterator tmp(m); diff --git a/storage/tianmu/core/parameterized_filter.cpp b/storage/tianmu/core/parameterized_filter.cpp index 48769973b..560e85065 100644 --- a/storage/tianmu/core/parameterized_filter.cpp +++ b/storage/tianmu/core/parameterized_filter.cpp @@ -1018,12 +1018,12 @@ void ParameterizedFilter::UpdateMultiIndex(bool count_only, int64_t limit) { It needs to be increased according to the number of executions. */ int no_dims = 0; - for (int tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) { + for (uint tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) { auto rcTable = rcTables[tableIndex]; if (rcTable->TableType() == TType::TEMP_TABLE) continue; bool isVald = false; - for (int i = 0; i < descriptors.Size(); i++) { + for (uint i = 0; i < descriptors.Size(); i++) { Descriptor &desc = descriptors[i]; /*The number of values in the (var_map) corresponding to the entity column is always 1, so only the first element in the (var_map) is judged here.*/ @@ -1516,7 +1516,7 @@ void ParameterizedFilter::TaskProcessPacks(MIUpdatingIterator *taskIterator, Tra taskIterator->Commit(false); } -void ParameterizedFilter::FilterDeletedByTable(JustATable *rcTable, int &no_dims, int &tableIndex) { +void ParameterizedFilter::FilterDeletedByTable(JustATable *rcTable, int &no_dims, int tableIndex) { Descriptor desc(table, no_dims); desc.op = common::Operator::O_EQ_ALL; desc.encoded = true; @@ -1550,7 +1550,7 @@ void ParameterizedFilter::FilterDeletedForSelectAll() { if (table) { auto &rcTables = table->GetTables(); int no_dims = 0; - for (int tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) { + for (uint tableIndex = 0; tableIndex < rcTables.size(); tableIndex++) { auto rcTable = rcTables[tableIndex]; if (rcTable->TableType() == TType::TEMP_TABLE) continue; diff --git a/storage/tianmu/core/parameterized_filter.h b/storage/tianmu/core/parameterized_filter.h index 0031a58c0..66dab7a85 100644 --- a/storage/tianmu/core/parameterized_filter.h +++ b/storage/tianmu/core/parameterized_filter.h @@ -77,7 +77,7 @@ class ParameterizedFilter final { void TaskProcessPacks(MIUpdatingIterator *taskIterator, Transaction *ci, common::RSValue *rf, DimensionVector *dims, int desc_number, int64_t limit, int one_dim); - void FilterDeletedByTable(JustATable *rcTable, int &no_dims, int &tableIndex); + void FilterDeletedByTable(JustATable *rcTable, int &no_dims, int tableIndex); void FilterDeletedForSelectAll(); MultiIndex *mind; diff --git a/storage/tianmu/core/proxy_hash_joiner.cpp b/storage/tianmu/core/proxy_hash_joiner.cpp index 62a02a86c..fec233c7d 100644 --- a/storage/tianmu/core/proxy_hash_joiner.cpp +++ b/storage/tianmu/core/proxy_hash_joiner.cpp @@ -128,7 +128,7 @@ class MIIteratorPoller { no_more_ = true; } - return std::move(pack_iter); + return pack_iter; } private: diff --git a/storage/tianmu/core/query_compile.cpp b/storage/tianmu/core/query_compile.cpp index 4ef9481e7..08ea3a318 100644 --- a/storage/tianmu/core/query_compile.cpp +++ b/storage/tianmu/core/query_compile.cpp @@ -1008,8 +1008,7 @@ QueryRouteTo Query::Compile(CompiledQuery *compiled_query, SELECT_LEX *selects_l SetLimit(sl, sl == selects_list ? 0 : sl->join->unit->global_parameters(), offset_value, limit_value); List *fields = &sl->fields_list; - Item *conds = - (ifNewJoinForTianmu || !sl->join->where_cond) ? conds = sl->where_cond() : conds = sl->join->where_cond; + Item *conds = (ifNewJoinForTianmu || !sl->join->where_cond) ? sl->where_cond() : sl->join->where_cond; ORDER *order = sl->order_list.first; @@ -1199,9 +1198,9 @@ JoinType Query::GetJoinTypeAndCheckExpr(uint outer_join, Item *on_expr) { } bool Query::IsLOJ(List *join) { - TABLE_LIST *join_ptr; + TABLE_LIST *join_ptr{nullptr}; List_iterator li(*join); - while (join_ptr = li++) { + while ((join_ptr = li++)) { JoinType join_type = GetJoinTypeAndCheckExpr(join_ptr->outer_join, join_ptr->join_cond()); if (join_ptr->join_cond() && (join_type == JoinType::JO_LEFT || join_type == JoinType::JO_RIGHT)) return true; diff --git a/storage/tianmu/core/task_executor.h b/storage/tianmu/core/task_executor.h index c30ede7ad..1753286cc 100644 --- a/storage/tianmu/core/task_executor.h +++ b/storage/tianmu/core/task_executor.h @@ -66,7 +66,7 @@ class TaskExecutor { auto task = std::make_unique>(std::move(func)); auto ret = task->get_future(); AddTask(std::move(task)); - return std::move(ret); + return ret; } void Exit(); diff --git a/storage/tianmu/core/tools.h b/storage/tianmu/core/tools.h index c45f1b0a5..d8c6ed29d 100644 --- a/storage/tianmu/core/tools.h +++ b/storage/tianmu/core/tools.h @@ -167,6 +167,8 @@ class TOCoordinate { co.rcattr = _t.co.rcattr; } + TOCoordinate &operator=(const TOCoordinate &) = default; + bool operator==(TOCoordinate const &oid) const { if (oid.ID != ID) return false; diff --git a/storage/tianmu/core/value_matching_table.h b/storage/tianmu/core/value_matching_table.h index ed3cb14fa..02e2e7dbc 100644 --- a/storage/tianmu/core/value_matching_table.h +++ b/storage/tianmu/core/value_matching_table.h @@ -52,7 +52,8 @@ class ValueMatchingTable { // abstract class: interface for value matching // already exists, false if put as a new row virtual bool FindCurrentRow(unsigned char *input_buffer, int64_t &row, bool add_if_new = true) = 0; - virtual bool FindCurrentRow(unsigned char *input_buffer, int64_t &row, bool add_if_new, int match_width) { + virtual bool FindCurrentRow(unsigned char *input_buffer, int64_t &row, bool add_if_new, + int match_width [[maybe_unused]]) { return FindCurrentRow(input_buffer, row, add_if_new); }; @@ -103,6 +104,7 @@ class ValueMatchingTable { // abstract class: interface for value matching class ValueMatching_OnePosition : public ValueMatchingTable { public: + using ValueMatchingTable::FindCurrentRow; ValueMatching_OnePosition(); ValueMatching_OnePosition(ValueMatching_OnePosition &sec); virtual ~ValueMatching_OnePosition(); @@ -136,6 +138,7 @@ class ValueMatching_OnePosition : public ValueMatchingTable { class ValueMatching_LookupTable : public mm::TraceableObject, public ValueMatchingTable { public: + using ValueMatchingTable::FindCurrentRow; ValueMatching_LookupTable(); ValueMatching_LookupTable(ValueMatching_LookupTable &sec); virtual ~ValueMatching_LookupTable(); diff --git a/storage/tianmu/index/rc_table_index.cpp b/storage/tianmu/index/rc_table_index.cpp index 586ad047a..326329b70 100644 --- a/storage/tianmu/index/rc_table_index.cpp +++ b/storage/tianmu/index/rc_table_index.cpp @@ -207,7 +207,8 @@ common::ErrorCode RCTableIndex::UpdateIndex(core::Transaction *tx, std::string_v return rc; } -common::ErrorCode RCTableIndex::DeleteIndex(core::Transaction *tx, std::string_view ¤tRowKey, uint64_t row) { +common::ErrorCode RCTableIndex::DeleteIndex(core::Transaction *tx, std::string_view ¤tRowKey, + uint64_t row [[maybe_unused]]) { StringWriter value, packkey; std::vector fields; diff --git a/storage/tianmu/index/rdb_meta_manager.cpp b/storage/tianmu/index/rdb_meta_manager.cpp index aaa3e7b74..29536fb71 100644 --- a/storage/tianmu/index/rdb_meta_manager.cpp +++ b/storage/tianmu/index/rdb_meta_manager.cpp @@ -37,8 +37,8 @@ namespace Tianmu { namespace index { -RdbKey::RdbKey(uint pos, uint keyno, rocksdb::ColumnFamilyHandle *cf_handle, uint16_t index_ver, uchar index_type, - bool is_reverse_cf, const char *_name, std::vector &cols) +RdbKey::RdbKey(uint pos, uint keyno [[maybe_unused]], rocksdb::ColumnFamilyHandle *cf_handle, uint16_t index_ver, + uchar index_type, bool is_reverse_cf, const char *_name, std::vector &cols) : index_pos_(pos), cf_handle_(cf_handle), index_ver_(index_ver), diff --git a/storage/tianmu/mm/tcm/tccommon.cpp b/storage/tianmu/mm/tcm/tccommon.cpp index 5f45b68b0..3516e2fcd 100755 --- a/storage/tianmu/mm/tcm/tccommon.cpp +++ b/storage/tianmu/mm/tcm/tccommon.cpp @@ -124,7 +124,7 @@ void SizeMap::Init() { // Initialize the mapping arrays int next_size = 0; for (size_t c = 1; c < kNumClasses; c++) { - const int max_size_in_class = (const int)class_to_size_[c]; + int max_size_in_class = static_cast(class_to_size_[c]); for (int s = next_size; s <= max_size_in_class; s += kAlignment) { class_array_[ClassIndex(s)] = c; } diff --git a/storage/tianmu/system/cacheable_item.cpp b/storage/tianmu/system/cacheable_item.cpp index 035c454e0..d70d95740 100644 --- a/storage/tianmu/system/cacheable_item.cpp +++ b/storage/tianmu/system/cacheable_item.cpp @@ -53,7 +53,7 @@ CacheableItem::CacheableItem(char const *owner_name, char const *object_id, int filename_offset = temp_filename.length(); // fill the file name - int i = 0, j = 0; + size_t i = 0, j = 0; while (owner_name[j] != 0 && i < kOwnerAndObjectLen) file_name_[filename_offset + (i++)] = owner_name[j++]; while (i < kMinOwnerNameLen) file_name_[filename_offset + (i++)] = '_'; diff --git a/storage/tianmu/types/bstring.cpp b/storage/tianmu/types/bstring.cpp index 77fcf987b..0db39da15 100644 --- a/storage/tianmu/types/bstring.cpp +++ b/storage/tianmu/types/bstring.cpp @@ -80,7 +80,7 @@ BString &BString::operator=(const RCDataType &rcdt) { return *this; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - *this = (BString &)rcdt; + *this = reinterpret_cast(const_cast(rcdt)); else TIANMU_ERROR("bad cast"); @@ -411,7 +411,7 @@ bool BString::operator==(const RCDataType &rcdt) const { if (null_ || rcdt.IsNull()) return false; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - return CompareWith((BString &)rcdt) == 0; + return CompareWith(reinterpret_cast(const_cast(rcdt))) == 0; return CompareWith(rcdt.ToBString()) == 0; } @@ -425,7 +425,7 @@ bool BString::operator<(const RCDataType &rcdt) const { if (null_ || rcdt.IsNull()) return false; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - return CompareWith((BString &)rcdt) < 0; + return CompareWith(reinterpret_cast(const_cast(rcdt))) < 0; return CompareWith(rcdt.ToBString()) < 0; } @@ -433,7 +433,7 @@ bool BString::operator>(const RCDataType &rcdt) const { if (null_ || rcdt.IsNull()) return false; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - return CompareWith((BString &)rcdt) > 0; + return CompareWith(reinterpret_cast(const_cast(rcdt))) > 0; return CompareWith(rcdt.ToBString()) > 0; } @@ -441,7 +441,7 @@ bool BString::operator>=(const RCDataType &rcdt) const { if (null_ || rcdt.IsNull()) return false; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - return CompareWith((BString &)rcdt) >= 0; + return CompareWith(reinterpret_cast(const_cast(rcdt))) >= 0; return CompareWith(rcdt.ToBString()) >= 0; } @@ -449,7 +449,7 @@ bool BString::operator<=(const RCDataType &rcdt) const { if (null_ || rcdt.IsNull()) return false; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - return CompareWith((BString &)rcdt) <= 0; + return CompareWith(reinterpret_cast(const_cast(rcdt))) <= 0; return CompareWith(rcdt.ToBString()) <= 0; } @@ -457,7 +457,7 @@ bool BString::operator!=(const RCDataType &rcdt) const { if (null_ || rcdt.IsNull()) return true; if (rcdt.GetValueType() == ValueTypeEnum::STRING_TYPE) - return CompareWith((BString &)rcdt) != 0; + return CompareWith(reinterpret_cast(const_cast(rcdt))) != 0; return CompareWith(rcdt.ToBString()) != 0; } diff --git a/storage/tianmu/types/rc_data_types.h b/storage/tianmu/types/rc_data_types.h index 6a34d9dfd..99f6fca97 100644 --- a/storage/tianmu/types/rc_data_types.h +++ b/storage/tianmu/types/rc_data_types.h @@ -134,6 +134,7 @@ enum class ValueTypeEnum { NULL_TYPE, DATE_TIME_TYPE, NUMERIC_TYPE, STRING_TYPE class RCDataType { public: RCDataType() : null_(true) {} + constexpr RCDataType(const RCDataType &) = default; virtual ~RCDataType(); public: @@ -174,6 +175,8 @@ class RCDataType { template class ValueBasic : public RCDataType { public: + constexpr ValueBasic(const ValueBasic &) = default; + ValueBasic() = default; ValueTypeEnum GetValueType() const override { return T::value_type_; } std::unique_ptr Clone() const override { return std::unique_ptr(new T((T &)*this)); }; static T null_value_;