From af9bed40e2694441237777f1487fd79b634ee637 Mon Sep 17 00:00:00 2001 From: hustjieke Date: Wed, 16 Nov 2022 06:16:59 +0000 Subject: [PATCH] feat(tianmu): formate code #11 --- storage/tianmu/core/aggregation_algorithm.cpp | 21 ++++---- storage/tianmu/core/aggregator_advanced.cpp | 9 ++-- storage/tianmu/core/column_bin_encoder.cpp | 6 ++- storage/tianmu/core/column_share.cpp | 2 +- storage/tianmu/core/condition_encoder.cpp | 6 +-- storage/tianmu/core/descriptor.cpp | 35 +++++++------ storage/tianmu/core/engine.cpp | 7 +-- storage/tianmu/core/engine.h | 7 +-- storage/tianmu/core/engine_convert.cpp | 4 +- storage/tianmu/core/engine_results.cpp | 14 ++--- storage/tianmu/core/ftree.cpp | 2 +- storage/tianmu/core/group_distinct_table.cpp | 2 +- storage/tianmu/core/parallel_hash_join.cpp | 6 +-- storage/tianmu/core/parameterized_filter.cpp | 4 +- storage/tianmu/core/rsi_bloom.cpp | 2 +- storage/tianmu/core/rsi_cmap.cpp | 2 +- storage/tianmu/core/rsi_histogram.cpp | 2 +- storage/tianmu/core/table_share.cpp | 2 +- storage/tianmu/core/temp_table.cpp | 3 +- storage/tianmu/core/temp_table_low.cpp | 6 +-- storage/tianmu/core/tianmu_attr.cpp | 15 +++--- storage/tianmu/core/tianmu_attr.h | 2 +- storage/tianmu/core/tianmu_attr_exeq_rs.cpp | 9 ++-- storage/tianmu/core/tianmu_attr_exqp.cpp | 7 +-- storage/tianmu/core/tianmu_mem_table.cpp | 5 +- storage/tianmu/core/tianmu_table.cpp | 31 ++++++----- storage/tianmu/core/value_or_null.cpp | 6 ++- storage/tianmu/core/value_set.cpp | 8 +-- storage/tianmu/exporter/data_exporter_txt.cpp | 3 +- storage/tianmu/handler/ha_my_tianmu.cpp | 4 +- storage/tianmu/handler/ha_tianmu.cpp | 10 ++-- storage/tianmu/index/rdb_meta_manager.cpp | 3 +- storage/tianmu/index/tianmu_table_index.cpp | 6 +-- storage/tianmu/mm/huge_heap_policy.cpp | 4 +- storage/tianmu/mm/traceable_object.cpp | 2 +- storage/tianmu/system/large_buffer.cpp | 2 +- storage/tianmu/types/bstring.cpp | 3 +- storage/tianmu/types/tianmu_data_types.cpp | 7 ++- storage/tianmu/types/tianmu_data_types.h | 8 +-- storage/tianmu/types/tianmu_datetime.cpp | 51 ++++++++++++------- storage/tianmu/types/tianmu_num.cpp | 5 +- storage/tianmu/types/tianmu_value_object.cpp | 4 +- storage/tianmu/types/value_parser4txt.cpp | 25 +++++---- storage/tianmu/vc/const_column.cpp | 2 +- storage/tianmu/vc/const_expr_column.cpp | 4 +- storage/tianmu/vc/expr_column.cpp | 2 +- storage/tianmu/vc/multi_value_column.h | 2 +- storage/tianmu/vc/subselect_column.cpp | 3 +- storage/tianmu/vc/type_cast_column.cpp | 9 ++-- 49 files changed, 222 insertions(+), 162 deletions(-) diff --git a/storage/tianmu/core/aggregation_algorithm.cpp b/storage/tianmu/core/aggregation_algorithm.cpp index 578004c3e..b1f9482bb 100644 --- a/storage/tianmu/core/aggregation_algorithm.cpp +++ b/storage/tianmu/core/aggregation_algorithm.cpp @@ -113,8 +113,9 @@ void AggregationAlgorithm::Aggregate(bool just_distinct, int64_t &limit, int64_t else if (cur_a.distinct) { max_no_of_distinct = cur_a.term.vc->GetApproxDistVals(false); // no nulls included if (tianmu_control_.isOn()) - tianmu_control_.lock(m_conn->GetThreadID()) << "Adding dist. column, min = " << min_v << ", max = " << max_v - << ", dist = " << max_no_of_distinct << system::unlock; + tianmu_control_.lock(m_conn->GetThreadID()) + << "Adding dist. column, min = " << min_v << ", max = " << max_v << ", dist = " << max_no_of_distinct + << system::unlock; } } if (max_no_of_distinct == 0) @@ -271,7 +272,7 @@ void AggregationAlgorithm::MultiDimensionalGroupByScan(GroupByWrapper &gbw, int6 << "Aggregating: " << mit.NumOfTuples() << " tuples left." << system::unlock; else tianmu_control_.lock(m_conn->GetThreadID()) << "Aggregating: " << gbw.TuplesNoOnes() << " tuples left, " - << displayed_no_groups << " gr. found so far" << system::unlock; + << displayed_no_groups << " gr. found so far" << system::unlock; } cur_tuple = 0; gbw.ClearNoGroups(); // count groups locally created in this pass @@ -343,7 +344,7 @@ void AggregationAlgorithm::MultiDimensionalGroupByScan(GroupByWrapper &gbw, int6 } tianmu_control_.lock(m_conn->GetThreadID()) << "Group/Aggregate end. Begin generating output." << system::unlock; tianmu_control_.lock(m_conn->GetThreadID()) << "Output rows: " << gbw.NumOfGroups() + gbw.TuplesNoOnes() - << ", output table row limit: " << t->GetPageSize() << system::unlock; + << ", output table row limit: " << t->GetPageSize() << system::unlock; int64_t output_size = (gbw.NumOfGroups() + gbw.TuplesNoOnes()) * t->GetOneOutputRecordSize(); gbw.RewindRows(); if (t->GetPageSize() >= (gbw.NumOfGroups() + gbw.TuplesNoOnes()) && output_size > (1L << 29) && @@ -837,8 +838,8 @@ void AggregationAlgorithm::ParallelFillOutputWrapper(GroupByWrapper &gbw, int64_ utils::result_set res; for (auto &gb : vgbw) { - res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&AggregationAlgorithm::TaskFillOutput, this, &gb, conn, offset, - limit)); + res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&AggregationAlgorithm::TaskFillOutput, this, &gb, conn, + offset, limit)); } res.get_all_with_except(); } @@ -922,8 +923,8 @@ void AggregationWorkerEnt::DistributeAggreTaskAverage(MIIterator &mit) { utils::result_set res; for (int i = 0; i < loopcnt; ++i) { - res.insert( - ha_tianmu_engine_->query_thread_pool.add_task(&AggregationWorkerEnt::PrepShardingCopy, this, &mit, gb_main, &vGBW)); + res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&AggregationWorkerEnt::PrepShardingCopy, this, &mit, + gb_main, &vGBW)); int pack_start = i * num; int pack_end = 0; @@ -969,8 +970,8 @@ void AggregationWorkerEnt::DistributeAggreTaskAverage(MIIterator &mit) { for (size_t i = 0; i < vTask.size(); ++i) { GroupByWrapper *gbw = i == 0 ? gb_main : vGBW[i].get(); - res1.insert(ha_tianmu_engine_->query_thread_pool.add_task(&AggregationWorkerEnt::TaskAggrePacks, this, &taskIterator[i], - &dims, &mit, &vTask[i], gbw, conn)); + res1.insert(ha_tianmu_engine_->query_thread_pool.add_task(&AggregationWorkerEnt::TaskAggrePacks, this, + &taskIterator[i], &dims, &mit, &vTask[i], gbw, conn)); } res1.get_all_with_except(); diff --git a/storage/tianmu/core/aggregator_advanced.cpp b/storage/tianmu/core/aggregator_advanced.cpp index 2cbb42c56..8238b8bef 100644 --- a/storage/tianmu/core/aggregator_advanced.cpp +++ b/storage/tianmu/core/aggregator_advanced.cpp @@ -160,7 +160,8 @@ int64_t AggregatorStdSampD::GetValue64(unsigned char *buf) { void AggregatorBitAnd::PutAggregatedValue(unsigned char *buf, const types::BString &v, int64_t factor) { stats_updated = false; types::TianmuNum val(common::CT::BIGINT); - if (!v.IsEmpty() && types::TianmuNum::Parse(v, val, common::CT::BIGINT) == common::ErrorCode::SUCCESS && !val.IsNull()) { + if (!v.IsEmpty() && types::TianmuNum::Parse(v, val, common::CT::BIGINT) == common::ErrorCode::SUCCESS && + !val.IsNull()) { PutAggregatedValue(buf, int64_t(val), factor); } } @@ -168,7 +169,8 @@ void AggregatorBitAnd::PutAggregatedValue(unsigned char *buf, const types::BStri void AggregatorBitOr::PutAggregatedValue(unsigned char *buf, const types::BString &v, int64_t factor) { stats_updated = false; types::TianmuNum val(common::CT::BIGINT); - if (!v.IsEmpty() && types::TianmuNum::Parse(v, val, common::CT::BIGINT) == common::ErrorCode::SUCCESS && !val.IsNull()) { + if (!v.IsEmpty() && types::TianmuNum::Parse(v, val, common::CT::BIGINT) == common::ErrorCode::SUCCESS && + !val.IsNull()) { PutAggregatedValue(buf, int64_t(val), factor); } } @@ -176,7 +178,8 @@ void AggregatorBitOr::PutAggregatedValue(unsigned char *buf, const types::BStrin void AggregatorBitXor::PutAggregatedValue(unsigned char *buf, const types::BString &v, int64_t factor) { stats_updated = false; types::TianmuNum val(common::CT::BIGINT); - if (!v.IsEmpty() && types::TianmuNum::Parse(v, val, common::CT::BIGINT) == common::ErrorCode::SUCCESS && !val.IsNull()) { + if (!v.IsEmpty() && types::TianmuNum::Parse(v, val, common::CT::BIGINT) == common::ErrorCode::SUCCESS && + !val.IsNull()) { PutAggregatedValue(buf, int64_t(val), factor); } } diff --git a/storage/tianmu/core/column_bin_encoder.cpp b/storage/tianmu/core/column_bin_encoder.cpp index 2e8a9854b..961b11a81 100644 --- a/storage/tianmu/core/column_bin_encoder.cpp +++ b/storage/tianmu/core/column_bin_encoder.cpp @@ -571,7 +571,8 @@ ColumnBinEncoder::EncoderDate::EncoderDate(vcolumn::VirtualColumn *vc, bool deco bool ColumnBinEncoder::EncoderDate::SecondColumn(vcolumn::VirtualColumn *vc) { // Possible conversions: only dates. if (vc->Type().GetTypeName() != common::CT::DATE) { - tianmu_control_.lock(vc->ConnInfo()->GetThreadID()) << "Nontrivial comparison: date with non-date" << system::unlock; + tianmu_control_.lock(vc->ConnInfo()->GetThreadID()) + << "Nontrivial comparison: date with non-date" << system::unlock; return false; } int64_t new_min_val = types::DT::DateSortEncoding(vc->RoughMin()); @@ -662,7 +663,8 @@ ColumnBinEncoder::EncoderYear::EncoderYear(vcolumn::VirtualColumn *vc, bool deco bool ColumnBinEncoder::EncoderYear::SecondColumn(vcolumn::VirtualColumn *vc) { // Possible conversions: only years. if (vc->Type().GetTypeName() != common::CT::YEAR) { - tianmu_control_.lock(vc->ConnInfo()->GetThreadID()) << "Nontrivial comparison: year with non-year" << system::unlock; + tianmu_control_.lock(vc->ConnInfo()->GetThreadID()) + << "Nontrivial comparison: year with non-year" << system::unlock; return false; } diff --git a/storage/tianmu/core/column_share.cpp b/storage/tianmu/core/column_share.cpp index 47794d610..8660c2ee7 100644 --- a/storage/tianmu/core/column_share.cpp +++ b/storage/tianmu/core/column_share.cpp @@ -22,8 +22,8 @@ #include "common/exception.h" #include "core/column_share.h" #include "core/engine.h" -#include "system/tianmu_system.h" #include "system/tianmu_file.h" +#include "system/tianmu_system.h" namespace Tianmu { namespace core { diff --git a/storage/tianmu/core/condition_encoder.cpp b/storage/tianmu/core/condition_encoder.cpp index 46ed1e3c4..54bd7b512 100644 --- a/storage/tianmu/core/condition_encoder.cpp +++ b/storage/tianmu/core/condition_encoder.cpp @@ -613,7 +613,7 @@ void ConditionEncoder::TransformINs() { desc->val2 = CQTerm(); desc->val2.vc = new vcolumn::ConstColumn(ValueOrNull(types::TianmuNum(attr->EncodeValue64(mvc.GetSetMin(mit), sharp), - static_cast(in_type.GetTypeName()))), + static_cast(in_type.GetTypeName()))), in_type); desc->val2.vc_id = desc->table->AddVirtColumn(desc->val2.vc); } else { @@ -650,12 +650,12 @@ void ConditionEncoder::TransformINs() { && span == mvc.AtLeastNoDistinctValues(mit, span + 1)) { desc->val2.vc = new vcolumn::ConstColumn( ValueOrNull(types::TianmuNum(val_max, attr->Type().GetScale(), ATI::IsRealType(in_type.GetTypeName()), - in_type.GetTypeName())), + in_type.GetTypeName())), in_type); desc->val2.vc_id = desc->table->AddVirtColumn(desc->val2.vc); desc->val1.vc = new vcolumn::ConstColumn( ValueOrNull(types::TianmuNum(val_min, attr->Type().GetScale(), ATI::IsRealType(in_type.GetTypeName()), - in_type.GetTypeName())), + in_type.GetTypeName())), in_type); desc->val1.vc_id = desc->table->AddVirtColumn(desc->val1.vc); if (desc->op == common::Operator::O_IN) diff --git a/storage/tianmu/core/descriptor.cpp b/storage/tianmu/core/descriptor.cpp index a3e2a5344..2e30b85e4 100644 --- a/storage/tianmu/core/descriptor.cpp +++ b/storage/tianmu/core/descriptor.cpp @@ -262,29 +262,32 @@ bool Descriptor::operator<=(const Descriptor &sec) const { if ((sec.op == common::Operator::O_LESS || sec.op == common::Operator::O_LESS_EQ || sec.op == common::Operator::O_MORE || sec.op == common::Operator::O_MORE_EQ || sec.op == common::Operator::O_EQ) && - types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, '\\')) + types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, + '\\')) return true; break; case common::Operator::O_LESS_EQ: if ((sec.op == common::Operator::O_LESS || sec.op == common::Operator::O_LESS_EQ) && - types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, '\\')) + types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, + '\\')) return true; break; case common::Operator::O_MORE_EQ: if ((sec.op == common::Operator::O_MORE || sec.op == common::Operator::O_MORE_EQ) && - types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, '\\')) + types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, + '\\')) return true; break; case common::Operator::O_LESS: if ((sec.op == common::Operator::O_LESS || sec.op == common::Operator::O_LESS_EQ) && types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), - common::Operator::O_LESS_EQ, '\\')) + common::Operator::O_LESS_EQ, '\\')) return true; break; case common::Operator::O_MORE: if ((sec.op == common::Operator::O_MORE || sec.op == common::Operator::O_MORE_EQ) && types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), - common::Operator::O_MORE_EQ, '\\')) + common::Operator::O_MORE_EQ, '\\')) return true; break; case common::Operator::O_BETWEEN: @@ -292,10 +295,12 @@ bool Descriptor::operator<=(const Descriptor &sec) const { val2.vc->GetValue(dummy_mit) <= sec.val2.vc->GetValue(dummy_mit)) return true; if ((sec.op == common::Operator::O_LESS || sec.op == common::Operator::O_LESS_EQ) && - types::TianmuValueObject::compare(val2.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, '\\')) + types::TianmuValueObject::compare(val2.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, + '\\')) return true; if ((sec.op == common::Operator::O_MORE || sec.op == common::Operator::O_MORE_EQ) && - types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, '\\')) + types::TianmuValueObject::compare(val1.vc->GetValue(dummy_mit), sec.val1.vc->GetValue(dummy_mit), sec.op, + '\\')) return true; break; case common::Operator::O_IN: { @@ -1104,10 +1109,10 @@ bool Descriptor::CheckCondition(const MIIterator &mit) { } } else { types::TianmuValueObject tianmu_value_obj1 = attr.vc->GetValue(mit, false); - val1_res = - val1.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN : common::Tribool(tianmu_value_obj1 >= val1.vc->GetValue(mit, false)); - val2_res = - val2.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN : common::Tribool(tianmu_value_obj1 <= val2.vc->GetValue(mit, false)); + val1_res = val1.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN + : common::Tribool(tianmu_value_obj1 >= val1.vc->GetValue(mit, false)); + val2_res = val2.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN + : common::Tribool(tianmu_value_obj1 <= val2.vc->GetValue(mit, false)); } if (op == common::Operator::O_BETWEEN) { if (val1_res != true || val2_res != true) @@ -1178,10 +1183,10 @@ bool Descriptor::IsNull(const MIIterator &mit) { } } else { types::TianmuValueObject tianmu_value_obj1 = attr.vc->GetValue(mit, false); - val1_res = - val1.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN : common::Tribool(tianmu_value_obj1 >= val1.vc->GetValue(mit, false)); - val2_res = - val2.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN : common::Tribool(tianmu_value_obj1 <= val2.vc->GetValue(mit, false)); + val1_res = val1.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN + : common::Tribool(tianmu_value_obj1 >= val1.vc->GetValue(mit, false)); + val2_res = val2.vc->IsNull(mit) ? common::TRIBOOL_UNKNOWN + : common::Tribool(tianmu_value_obj1 <= val2.vc->GetValue(mit, false)); } if (common::Tribool::And(val1_res, val2_res) == common::TRIBOOL_UNKNOWN) return true; diff --git a/storage/tianmu/core/engine.cpp b/storage/tianmu/core/engine.cpp index eee5d8fca..2a5549fa2 100644 --- a/storage/tianmu/core/engine.cpp +++ b/storage/tianmu/core/engine.cpp @@ -25,10 +25,10 @@ #include "common/data_format.h" #include "common/exception.h" #include "common/mysql_gate.h" -#include "core/tianmu_mem_table.h" #include "core/table_share.h" #include "core/task_executor.h" #include "core/temp_table.h" +#include "core/tianmu_mem_table.h" #include "core/tools.h" #include "core/transaction.h" #include "mm/initializer.h" @@ -808,8 +808,9 @@ void Engine::TruncateTable(const std::string &table_path, [[maybe_unused]] THD * TIANMU_LOG(LogCtl_Level::INFO, "Truncated table %s, ID = %u", table_path.c_str(), id); } -void Engine::GetTableIterator(const std::string &table_path, TianmuTable::Iterator &iter_begin, TianmuTable::Iterator &iter_end, - std::shared_ptr &table, const std::vector &attrs, THD *thd) { +void Engine::GetTableIterator(const std::string &table_path, TianmuTable::Iterator &iter_begin, + TianmuTable::Iterator &iter_end, std::shared_ptr &table, + const std::vector &attrs, THD *thd) { table = GetTx(thd)->GetTableByPath(table_path); iter_begin = table->Begin(attrs); iter_end = table->End(); diff --git a/storage/tianmu/core/engine.h b/storage/tianmu/core/engine.h index 3c957f1bb..d98a4d5d9 100644 --- a/storage/tianmu/core/engine.h +++ b/storage/tianmu/core/engine.h @@ -29,9 +29,9 @@ #include "core/data_cache.h" #include "core/object_cache.h" #include "core/query.h" -#include "core/tianmu_table.h" #include "core/table_share.h" #include "core/temp_table.h" +#include "core/tianmu_table.h" #include "exporter/data_exporter.h" #include "exporter/export2file.h" #include "index/tianmu_table_index.h" @@ -100,8 +100,9 @@ class Engine final { std::vector GetTableAttributesInfo(const std::string &table_path, TABLE_SHARE *table_share); void UpdateAndStoreColumnComment(TABLE *table, int field_id, Field *source_field, int source_field_id, CHARSET_INFO *cs); - void GetTableIterator(const std::string &table_path, TianmuTable::Iterator &iter_begin, TianmuTable::Iterator &iter_end, - std::shared_ptr &table, const std::vector &, THD *thd); + void GetTableIterator(const std::string &table_path, TianmuTable::Iterator &iter_begin, + TianmuTable::Iterator &iter_end, std::shared_ptr &table, const std::vector &, + THD *thd); common::TianmuError RunLoader(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, void *arg); void CommitTx(THD *thd, bool all); void Rollback(THD *thd, bool all, bool force_error_message = false); diff --git a/storage/tianmu/core/engine_convert.cpp b/storage/tianmu/core/engine_convert.cpp index 573012ce4..0b9d6dcaf 100644 --- a/storage/tianmu/core/engine_convert.cpp +++ b/storage/tianmu/core/engine_convert.cpp @@ -456,8 +456,8 @@ int Engine::Convert(int &is_null, String *value, types::TianmuDataType &rcitem, if (types::TianmuDateTime *tianmu_dt = dynamic_cast(&rcitem)) { if (*tianmu_dt != types::kTianmuTimestampSpec) { MYSQL_TIME local_time; - my_time_t secs = tianmu_sec_since_epoch(tianmu_dt->Year(), tianmu_dt->Month(), tianmu_dt->Day(), tianmu_dt->Hour(), - tianmu_dt->Minute(), tianmu_dt->Second()); + my_time_t secs = tianmu_sec_since_epoch(tianmu_dt->Year(), tianmu_dt->Month(), tianmu_dt->Day(), + tianmu_dt->Hour(), tianmu_dt->Minute(), tianmu_dt->Second()); current_txn_->Thd()->variables.time_zone->gmt_sec_to_TIME(&local_time, secs); char buf[32]; local_time.second_part = tianmu_dt->MicroSecond(); diff --git a/storage/tianmu/core/engine_results.cpp b/storage/tianmu/core/engine_results.cpp index 2785b088c..fcacc1479 100644 --- a/storage/tianmu/core/engine_results.cpp +++ b/storage/tianmu/core/engine_results.cpp @@ -323,13 +323,15 @@ void ResultSender::SendRecord(const std::vectordec_value(), tianmu_dt, item->decimals); isum_hybrid_rcbase->null_value = is_null; } else if (isum_hybrid_rcbase->result_type() == INT_RESULT) { - Engine::Convert(is_null, isum_hybrid_rcbase->int64_value(), tianmu_dt, isum_hybrid_rcbase->hybrid_field_type_); + Engine::Convert(is_null, isum_hybrid_rcbase->int64_value(), tianmu_dt, + isum_hybrid_rcbase->hybrid_field_type_); isum_hybrid_rcbase->null_value = is_null; } else if (isum_hybrid_rcbase->result_type() == REAL_RESULT) { Engine::Convert(is_null, isum_hybrid_rcbase->real_value(), tianmu_dt); isum_hybrid_rcbase->null_value = is_null; } else if (isum_hybrid_rcbase->result_type() == STRING_RESULT) { - Engine::Convert(is_null, isum_hybrid_rcbase->string_value(), tianmu_dt, isum_hybrid_rcbase->hybrid_field_type_); + Engine::Convert(is_null, isum_hybrid_rcbase->string_value(), tianmu_dt, + isum_hybrid_rcbase->hybrid_field_type_); isum_hybrid_rcbase->null_value = is_null; } break; @@ -387,10 +389,10 @@ void ResultSender::Finalize(TempTable *result_table) { auto &sctx = thd->m_main_security_ctx; if (tianmu_querylog_.isOn()) tianmu_querylog_ << system::lock << "\tClientIp:" << (sctx.ip().length ? sctx.ip().str : "unkownn") - << "\tClientHostName:" << (sctx.host().length ? sctx.host().str : "unknown") - << "\tClientPort:" << thd->peer_port << "\tUser:" << sctx.user().str << global_serverinfo_ - << "\tAffectRows:" << affect_rows << "\tResultRows:" << rows_sent << "\tDBName:" << thd->db().str - << "\tCosttime(ms):" << cost_time << "\tSQL:" << thd->query().str << system::unlock; + << "\tClientHostName:" << (sctx.host().length ? sctx.host().str : "unknown") + << "\tClientPort:" << thd->peer_port << "\tUser:" << sctx.user().str << global_serverinfo_ + << "\tAffectRows:" << affect_rows << "\tResultRows:" << rows_sent << "\tDBName:" << thd->db().str + << "\tCosttime(ms):" << cost_time << "\tSQL:" << thd->query().str << system::unlock; TIANMU_LOG(LogCtl_Level::DEBUG, "Result: %" PRId64 " Costtime(ms): %" PRId64, rows_sent, cost_time); } diff --git a/storage/tianmu/core/ftree.cpp b/storage/tianmu/core/ftree.cpp index 4a8e5aba6..219a75e6d 100644 --- a/storage/tianmu/core/ftree.cpp +++ b/storage/tianmu/core/ftree.cpp @@ -20,8 +20,8 @@ #include #include -#include "system/tianmu_system.h" #include "system/tianmu_file.h" +#include "system/tianmu_system.h" namespace Tianmu { namespace core { diff --git a/storage/tianmu/core/group_distinct_table.cpp b/storage/tianmu/core/group_distinct_table.cpp index cf9ea2095..a0b3f9c7d 100644 --- a/storage/tianmu/core/group_distinct_table.cpp +++ b/storage/tianmu/core/group_distinct_table.cpp @@ -144,7 +144,7 @@ void GroupDistinctTable::InitializeBuffers(int64_t max_no_rows) // max_no_rows input_buffer = reinterpret_cast(new int[total_width / 4 + 1]); // ensure proper memory alignment memset(input_buffer, 0, total_width / 4 + 1); tianmu_control_.lock(m_conn->GetThreadID()) << "GroupDistinctTable initialized as Hash(" << no_rows << "), " - << group_bytes << "+" << value_bytes << " bytes." << system::unlock; + << group_bytes << "+" << value_bytes << " bytes." << system::unlock; Clear(); } diff --git a/storage/tianmu/core/parallel_hash_join.cpp b/storage/tianmu/core/parallel_hash_join.cpp index ed3c3e52a..249c81bf9 100644 --- a/storage/tianmu/core/parallel_hash_join.cpp +++ b/storage/tianmu/core/parallel_hash_join.cpp @@ -527,7 +527,7 @@ int64_t ParallelHashJoiner::TraverseDim(MIIterator &mit, int64_t *outer_tuples) int traversed_fragment_count = (int)task_iterators.size(); tianmu_control_.lock(m_conn->GetThreadID()) << "Begin traversed with " << traversed_fragment_count << " threads with " - << splitting_type << " type." << system::unlock; + << splitting_type << " type." << system::unlock; std::vector traverse_task_params; traverse_task_params.reserve(task_iterators.size()); @@ -1171,8 +1171,8 @@ int64_t ParallelHashJoiner::SubmitOuterMatched(MIIterator &miter) { params.task_iter = iter; params.build_item = multi_index_builder_->CreateBuildItem(); - res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&ParallelHashJoiner::AsyncSubmitOuterMatched, this, ¶ms, - outer_matched_filter_.get())); + res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&ParallelHashJoiner::AsyncSubmitOuterMatched, this, + ¶ms, outer_matched_filter_.get())); } } catch (std::exception &e) { res.get_all_with_except(); diff --git a/storage/tianmu/core/parameterized_filter.cpp b/storage/tianmu/core/parameterized_filter.cpp index fd0b5c488..120431bcf 100644 --- a/storage/tianmu/core/parameterized_filter.cpp +++ b/storage/tianmu/core/parameterized_filter.cpp @@ -1423,8 +1423,8 @@ void ParameterizedFilter::ApplyDescriptor(int desc_number, int64_t limit) utils::result_set res; for (int i = 0; i < task_num; ++i) { res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&ParameterizedFilter::TaskProcessPacks, this, - &taskIterator[i], current_txn_, rf, &dims, desc_number, - limit, one_dim)); + &taskIterator[i], current_txn_, rf, &dims, desc_number, + limit, one_dim)); } res.get_all_with_except(); diff --git a/storage/tianmu/core/rsi_bloom.cpp b/storage/tianmu/core/rsi_bloom.cpp index 7fb702f87..75310931f 100644 --- a/storage/tianmu/core/rsi_bloom.cpp +++ b/storage/tianmu/core/rsi_bloom.cpp @@ -17,8 +17,8 @@ #include "core/rsi_bloom.h" #include "core/pack_str.h" -#include "system/tianmu_system.h" #include "system/tianmu_file.h" +#include "system/tianmu_system.h" namespace Tianmu { namespace core { diff --git a/storage/tianmu/core/rsi_cmap.cpp b/storage/tianmu/core/rsi_cmap.cpp index e3fbff699..e93e7fd2b 100644 --- a/storage/tianmu/core/rsi_cmap.cpp +++ b/storage/tianmu/core/rsi_cmap.cpp @@ -17,8 +17,8 @@ #include "core/rsi_cmap.h" #include "core/pack_str.h" -#include "system/tianmu_system.h" #include "system/tianmu_file.h" +#include "system/tianmu_system.h" #include "util/fs.h" namespace Tianmu { diff --git a/storage/tianmu/core/rsi_histogram.cpp b/storage/tianmu/core/rsi_histogram.cpp index fbe5acd7f..2b9ac93c0 100644 --- a/storage/tianmu/core/rsi_histogram.cpp +++ b/storage/tianmu/core/rsi_histogram.cpp @@ -19,8 +19,8 @@ #include "core/pack.h" #include "core/rsi_histogram.h" -#include "system/tianmu_system.h" #include "system/tianmu_file.h" +#include "system/tianmu_system.h" namespace Tianmu { namespace core { diff --git a/storage/tianmu/core/table_share.cpp b/storage/tianmu/core/table_share.cpp index 1403e46fb..c324ece34 100644 --- a/storage/tianmu/core/table_share.cpp +++ b/storage/tianmu/core/table_share.cpp @@ -19,8 +19,8 @@ #include #include -#include "core/tianmu_table.h" #include "core/table_share.h" +#include "core/tianmu_table.h" namespace Tianmu { namespace core { diff --git a/storage/tianmu/core/temp_table.cpp b/storage/tianmu/core/temp_table.cpp index b1e617362..d8c17aa4e 100644 --- a/storage/tianmu/core/temp_table.cpp +++ b/storage/tianmu/core/temp_table.cpp @@ -1385,7 +1385,8 @@ void TempTable::Union(TempTable *t, int all) { int64_t first_no_obj = first_mask.NumOfOnes(); int64_t sec_no_obj = sec_mask.NumOfOnes(); int64_t new_no_obj = first_no_obj + sec_no_obj; - tianmu_control_.lock(m_conn->GetThreadID()) << "UNION: generating result (" << new_no_obj << " rows)." << system::unlock; + tianmu_control_.lock(m_conn->GetThreadID()) + << "UNION: generating result (" << new_no_obj << " rows)." << system::unlock; uint new_page_size = CalculatePageSize(new_no_obj); for (uint i = 0; i < NumOfDisplaybleAttrs(); i++) { Attr *first_attr = GetDisplayableAttrP(i); diff --git a/storage/tianmu/core/temp_table_low.cpp b/storage/tianmu/core/temp_table_low.cpp index 39811401f..3f28ee750 100644 --- a/storage/tianmu/core/temp_table_low.cpp +++ b/storage/tianmu/core/temp_table_low.cpp @@ -212,7 +212,7 @@ bool TempTable::OrderByAndMaterialize(std::vector &ord, int64_t utils::result_set res; for (int i = 0; i < task_num; i++) res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&TempTable::TaskPutValueInST, this, &taskIterator[i], - current_txn_, &subsorted_table[i])); + current_txn_, &subsorted_table[i])); if (filter.mind->m_conn->Killed()) throw common::KilledException("Query killed by user"); @@ -405,8 +405,8 @@ void TempTable::FillMaterializedBuffers(int64_t local_limit, int64_t local_offse utils::result_set res; for (uint i = 1; i < attrs.size(); i++) { if (!skip_parafilloutput[i]) { - res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&TempTable::FillbufferTask, this, attrs[i], current_txn_, - &page_start, start_row, page_end)); + res.insert(ha_tianmu_engine_->query_thread_pool.add_task(&TempTable::FillbufferTask, this, attrs[i], + current_txn_, &page_start, start_row, page_end)); } } res.get_all_with_except(); diff --git a/storage/tianmu/core/tianmu_attr.cpp b/storage/tianmu/core/tianmu_attr.cpp index 09f2cb595..e54792ac1 100644 --- a/storage/tianmu/core/tianmu_attr.cpp +++ b/storage/tianmu/core/tianmu_attr.cpp @@ -327,14 +327,14 @@ void TianmuAttr::PostCommit() { ha_tianmu_engine_->DeferRemove(Path() / common::COL_VERSION_DIR / m_version.ToString(), m_tid); if (m_share->has_filter_bloom) - ha_tianmu_engine_->DeferRemove(Path() / common::COL_FILTER_DIR / common::COL_FILTER_BLOOM_DIR / m_version.ToString(), - m_tid); + ha_tianmu_engine_->DeferRemove( + Path() / common::COL_FILTER_DIR / common::COL_FILTER_BLOOM_DIR / m_version.ToString(), m_tid); if (m_share->has_filter_cmap) - ha_tianmu_engine_->DeferRemove(Path() / common::COL_FILTER_DIR / common::COL_FILTER_CMAP_DIR / m_version.ToString(), - m_tid); + ha_tianmu_engine_->DeferRemove( + Path() / common::COL_FILTER_DIR / common::COL_FILTER_CMAP_DIR / m_version.ToString(), m_tid); if (m_share->has_filter_hist) - ha_tianmu_engine_->DeferRemove(Path() / common::COL_FILTER_DIR / common::COL_FILTER_HIST_DIR / m_version.ToString(), - m_tid); + ha_tianmu_engine_->DeferRemove( + Path() / common::COL_FILTER_DIR / common::COL_FILTER_HIST_DIR / m_version.ToString(), m_tid); m_version = m_tx->GetID(); } @@ -738,7 +738,8 @@ int64_t TianmuAttr::EncodeValue64(types::TianmuDataType *v, bool &rounded, commo return vv; } -int64_t TianmuAttr::EncodeValue64(const types::TianmuValueObject &v, bool &rounded, common::ErrorCode *tianmu_err_code) { +int64_t TianmuAttr::EncodeValue64(const types::TianmuValueObject &v, bool &rounded, + common::ErrorCode *tianmu_err_code) { return EncodeValue64(v.Get(), rounded, tianmu_err_code); } diff --git a/storage/tianmu/core/tianmu_attr.h b/storage/tianmu/core/tianmu_attr.h index 72d6d7600..b376a06eb 100644 --- a/storage/tianmu/core/tianmu_attr.h +++ b/storage/tianmu/core/tianmu_attr.h @@ -28,11 +28,11 @@ #include "core/ftree.h" #include "core/pack.h" #include "core/physical_column.h" -#include "core/tianmu_attr_typeinfo.h" #include "core/rough_multi_index.h" #include "core/rsi_bloom.h" #include "core/rsi_cmap.h" #include "core/rsi_histogram.h" +#include "core/tianmu_attr_typeinfo.h" #include "core/tools.h" #include "loader/value_cache.h" #include "mm/traceable_object.h" diff --git a/storage/tianmu/core/tianmu_attr_exeq_rs.cpp b/storage/tianmu/core/tianmu_attr_exeq_rs.cpp index 62d413caf..2cb0ed992 100644 --- a/storage/tianmu/core/tianmu_attr_exeq_rs.cpp +++ b/storage/tianmu/core/tianmu_attr_exeq_rs.cpp @@ -247,9 +247,10 @@ common::RSValue TianmuAttr::RoughCheck(int pack, Descriptor &d, bool additional_ res = common::RSValue::RS_NONE; // calculate as for common::Operator::O_IN and then take // common::Operator::O_NOT_IN into account } else if (dpn.min_i == dpn.max_i) { - types::TianmuValueObject tianmu_value_obj(ATI::IsDateTimeType(TypeName()) - ? types::TianmuValueObject(types::TianmuDateTime(dpn.min_i, TypeName())) - : types::TianmuValueObject(types::TianmuNum(dpn.min_i, Type().GetScale()))); + types::TianmuValueObject tianmu_value_obj( + ATI::IsDateTimeType(TypeName()) + ? types::TianmuValueObject(types::TianmuDateTime(dpn.min_i, TypeName())) + : types::TianmuValueObject(types::TianmuNum(dpn.min_i, Type().GetScale()))); res = (mvc->Contains(mit, *tianmu_value_obj) != false) ? common::RSValue::RS_ALL : common::RSValue::RS_NONE; } else { if (auto sp = GetFilter_Hist()) @@ -793,7 +794,7 @@ uint64_t TianmuAttr::ApproxDistinctVals(bool incl_nulls, Filter *f, common::RSVa } uint64_t TianmuAttr::ExactDistinctVals(Filter *f) // provide the exact number of diff. non-null values, if - // possible, or common::NULL_VALUE_64 + // possible, or common::NULL_VALUE_64 { if (f == nullptr) // no exact information about tuples => nothing can be // determined for sure diff --git a/storage/tianmu/core/tianmu_attr_exqp.cpp b/storage/tianmu/core/tianmu_attr_exqp.cpp index afe079087..0280cd5c6 100644 --- a/storage/tianmu/core/tianmu_attr_exqp.cpp +++ b/storage/tianmu/core/tianmu_attr_exqp.cpp @@ -105,7 +105,8 @@ common::ErrorCode TianmuAttr::EvaluateOnIndex(MIUpdatingIterator &mit, int dim, return rv; } -common::ErrorCode TianmuAttr::EvaluateOnIndex_BetweenInt(MIUpdatingIterator &mit, int dim, Descriptor &d, int64_t limit) { +common::ErrorCode TianmuAttr::EvaluateOnIndex_BetweenInt(MIUpdatingIterator &mit, int dim, Descriptor &d, + int64_t limit) { common::ErrorCode rv = common::ErrorCode::FAILED; auto indextab = ha_tianmu_engine_->GetTableIndex(m_share->owner->Path()); if (!indextab) @@ -168,7 +169,7 @@ common::ErrorCode TianmuAttr::EvaluateOnIndex_BetweenInt(MIUpdatingIterator &mit } common::ErrorCode TianmuAttr::EvaluateOnIndex_BetweenString(MIUpdatingIterator &mit, int dim, Descriptor &d, - int64_t limit) { + int64_t limit) { common::ErrorCode rv = common::ErrorCode::FAILED; auto indextab = ha_tianmu_engine_->GetTableIndex(m_share->owner->Path()); if (!indextab) @@ -234,7 +235,7 @@ common::ErrorCode TianmuAttr::EvaluateOnIndex_BetweenString(MIUpdatingIterator & } common::ErrorCode TianmuAttr::EvaluateOnIndex_BetweenString_UTF(MIUpdatingIterator &mit, int dim, Descriptor &d, - int64_t limit) { + int64_t limit) { common::ErrorCode rv = common::ErrorCode::FAILED; auto indextab = ha_tianmu_engine_->GetTableIndex(m_share->owner->Path()); if (!indextab) diff --git a/storage/tianmu/core/tianmu_mem_table.cpp b/storage/tianmu/core/tianmu_mem_table.cpp index ffc150ccd..ec2af3066 100644 --- a/storage/tianmu/core/tianmu_mem_table.cpp +++ b/storage/tianmu/core/tianmu_mem_table.cpp @@ -17,8 +17,8 @@ #include "core/tianmu_mem_table.h" #include "common/common_definitions.h" -#include "core/tianmu_table.h" #include "core/table_share.h" +#include "core/tianmu_table.h" #include "core/transaction.h" #include "index/kv_store.h" #include "index/kv_transaction.h" @@ -63,7 +63,8 @@ TianmuMemTable::TianmuMemTable(const std::string name, const uint32_t mem_id, co stat.write_cnt = next_insert_id_.load() - next_load_id_.load(); } -std::shared_ptr TianmuMemTable::CreateMemTable(std::shared_ptr share, const std::string mem_name) { +std::shared_ptr TianmuMemTable::CreateMemTable(std::shared_ptr share, + const std::string mem_name) { std::string table_name = share->Path(); std::string normalized_name; if (!index::NormalizeName(table_name, normalized_name)) { diff --git a/storage/tianmu/core/tianmu_table.cpp b/storage/tianmu/core/tianmu_table.cpp index cc45b0497..6093bcaa8 100644 --- a/storage/tianmu/core/tianmu_table.cpp +++ b/storage/tianmu/core/tianmu_table.cpp @@ -24,9 +24,9 @@ #include "common/exception.h" #include "core/engine.h" #include "core/pack_guardian.h" +#include "core/table_share.h" #include "core/tianmu_attr.h" #include "core/tianmu_table.h" -#include "core/table_share.h" #include "core/transaction.h" #include "handler/ha_tianmu.h" #include "loader/load_parser.h" @@ -94,7 +94,7 @@ void TianmuTable::CreateNew(const std::shared_ptr &opt) { } void TianmuTable::Alter(const std::string &table_path, std::vector &new_cols, std::vector &old_cols, - size_t no_objs) { + size_t no_objs) { fs::path tmp_dir = table_path + ".tmp"; fs::path tab_dir = table_path + common::TIANMU_EXT; @@ -276,7 +276,8 @@ void TianmuTable::CommitVersion() { utils::result_set res; bool no_except = true; - for (auto &attr : m_attrs) res.insert(ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::SaveVersion, attr.get())); + for (auto &attr : m_attrs) + res.insert(ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::SaveVersion, attr.get())); std::vector changed_columns; changed_columns.reserve(m_attrs.size()); @@ -498,7 +499,7 @@ void TianmuTable::Iterator::LockPacks() { } TianmuTable::Iterator TianmuTable::Iterator::CreateBegin(TianmuTable &table, std::shared_ptr filter, - const std::vector &attrs) { + const std::vector &attrs) { TianmuTable::Iterator ret(table, filter); ret.Initialize(attrs); ret.it.Rewind(); @@ -572,7 +573,8 @@ void TianmuTable::LoadDataInfile(system::IOParameters &iop) { "Invalid table ID(" + std::to_string(GetID()) + "/" + std::to_string(iop.TableID()) + "): " + m_path.string()); } - FunctionExecutor fe(std::bind(&TianmuTable::LockPackInfoForUse, this), std::bind(&TianmuTable::UnlockPackInfoFromUse, this)); + FunctionExecutor fe(std::bind(&TianmuTable::LockPackInfoForUse, this), + std::bind(&TianmuTable::UnlockPackInfoFromUse, this)); if (iop.LoadDelayed()) { if (tianmu_sysvar_enable_rowstore) { @@ -708,7 +710,8 @@ void TianmuTable::Field2VC(Field *f, loader::ValueCache &vc, size_t col) { } int TianmuTable::Insert(TABLE *table) { - FunctionExecutor fe(std::bind(&TianmuTable::LockPackInfoForUse, this), std::bind(&TianmuTable::UnlockPackInfoFromUse, this)); + FunctionExecutor fe(std::bind(&TianmuTable::LockPackInfoForUse, this), + std::bind(&TianmuTable::UnlockPackInfoFromUse, this)); my_bitmap_map *org_bitmap = dbug_tmp_use_all_columns(table, table->read_set); std::shared_ptr defer(nullptr, @@ -773,8 +776,8 @@ uint64_t TianmuTable::ProceedNormal(system::IOParameters &iop) { if (parser.GetNoRow() > 0) { utils::result_set res; for (uint att = 0; att < m_attrs.size(); ++att) { - res.insert(ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::LoadData, m_attrs[att].get(), &value_buffers[att], - current_txn_)); + res.insert(ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::LoadData, m_attrs[att].get(), + &value_buffers[att], current_txn_)); } res.get_all(); } @@ -969,7 +972,8 @@ int TianmuTable::binlog_insert2load_log_event(system::IOParameters &iop) { return mysql_bin_log.write_event(&e); } -int TianmuTable::binlog_insert2load_block(std::vector &vcs, uint load_obj, system::IOParameters &iop) { +int TianmuTable::binlog_insert2load_block(std::vector &vcs, uint load_obj, + system::IOParameters &iop) { uint block_len, max_event_size; uchar *buffer = nullptr; size_t buf_sz = 16_MB; @@ -1028,7 +1032,7 @@ int TianmuTable::binlog_insert2load_block(std::vector &vcs, s = types::BString(); else { types::TianmuNum rcd(v, m_attrs[att]->Type().GetScale(), m_attrs[att]->Type().IsFloat(), - m_attrs[att]->TypeName()); + m_attrs[att]->TypeName()); s = rcd.ToBString(); } std::memcpy(ptr, s.GetDataBytesPointer(), s.size()); @@ -1278,8 +1282,8 @@ uint64_t TianmuTable::ProcessDelayed(system::IOParameters &iop) { if (real_loaded_rows > 0) { utils::result_set res; for (uint att = 0; att < m_attrs.size(); ++att) { - res.insert( - ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::LoadData, m_attrs[att].get(), &vcs[att], current_txn_)); + res.insert(ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::LoadData, m_attrs[att].get(), &vcs[att], + current_txn_)); } res.get_all(); no_loaded_rows += real_loaded_rows; @@ -1370,7 +1374,8 @@ int TianmuTable::MergeMemTable(system::IOParameters &iop) { if (real_loaded_rows > 0) { utils::result_set res; for (uint att = 0; att < m_attrs.size(); ++att) { - res.insert(ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::LoadData, m_attrs[att].get(), &vcs[att], m_tx)); + res.insert( + ha_tianmu_engine_->load_thread_pool.add_task(&TianmuAttr::LoadData, m_attrs[att].get(), &vcs[att], m_tx)); } res.get_all(); no_loaded_rows += real_loaded_rows; diff --git a/storage/tianmu/core/value_or_null.cpp b/storage/tianmu/core/value_or_null.cpp index f6c71d136..24fe160b5 100644 --- a/storage/tianmu/core/value_or_null.cpp +++ b/storage/tianmu/core/value_or_null.cpp @@ -95,7 +95,11 @@ ValueOrNull::ValueOrNull(types::TianmuNum const &tianmu_n) : x(tianmu_n.GetValue ValueOrNull::ValueOrNull(types::TianmuDateTime const &tianmu_dt) : x(tianmu_dt.GetInt64()), null(tianmu_dt.IsNull()) {} ValueOrNull::ValueOrNull(types::BString const &tianmu_s) - : x(common::NULL_VALUE_64), sp(new char[tianmu_s.len_ + 1]), len(tianmu_s.len_), string_owner(true), null(tianmu_s.IsNull()) { + : x(common::NULL_VALUE_64), + sp(new char[tianmu_s.len_ + 1]), + len(tianmu_s.len_), + string_owner(true), + null(tianmu_s.IsNull()) { std::memcpy(sp, tianmu_s.val_, len); sp[len] = 0; } diff --git a/storage/tianmu/core/value_set.cpp b/storage/tianmu/core/value_set.cpp index 3d26ca3d1..4bf914632 100644 --- a/storage/tianmu/core/value_set.cpp +++ b/storage/tianmu/core/value_set.cpp @@ -17,8 +17,8 @@ #include "common/common_definitions.h" #include "core/filter.h" #include "core/tianmu_attr_typeinfo.h" -#include "types/tianmu_num.h" #include "types/text_stat.h" +#include "types/tianmu_num.h" #include "util/hash64.h" #include "value_set.h" @@ -441,7 +441,8 @@ void ValueSet::Prepare(common::CT at, int scale, DTCollation coll) { delete tianmu_dt; } else { delete tianmu_dt; - tianmu_dt = static_cast(types::TianmuDateTime::GetSpecialValue(at).Clone().release()); + tianmu_dt = + static_cast(types::TianmuDateTime::GetSpecialValue(at).Clone().release()); if (!new_values.insert(tianmu_dt).second) delete tianmu_dt; } @@ -457,7 +458,8 @@ void ValueSet::Prepare(common::CT at, int scale, DTCollation coll) { delete tianmu_dt; } catch (common::DataTypeConversionException &) { delete tianmu_dt; - tianmu_dt = static_cast(types::TianmuDateTime::GetSpecialValue(at).Clone().release()); + tianmu_dt = + static_cast(types::TianmuDateTime::GetSpecialValue(at).Clone().release()); if (!new_values.insert(tianmu_n).second) delete tianmu_dt; } diff --git a/storage/tianmu/exporter/data_exporter_txt.cpp b/storage/tianmu/exporter/data_exporter_txt.cpp index 48b15ff32..110926b8b 100644 --- a/storage/tianmu/exporter/data_exporter_txt.cpp +++ b/storage/tianmu/exporter/data_exporter_txt.cpp @@ -70,7 +70,8 @@ void DEforTxt::PutBin(const types::BString &str) { void DEforTxt::PutNumeric(int64_t num) { types::TianmuNum tianmu_n(num, source_attr_infos_[cur_attr_].Scale(), - core::ATI::IsRealType(source_attr_infos_[cur_attr_].Type()), source_attr_infos_[cur_attr_].Type()); + core::ATI::IsRealType(source_attr_infos_[cur_attr_].Type()), + source_attr_infos_[cur_attr_].Type()); types::BString tianmu_s = tianmu_n.ToBString(); WriteString(tianmu_s); WriteValueEnd(); diff --git a/storage/tianmu/handler/ha_my_tianmu.cpp b/storage/tianmu/handler/ha_my_tianmu.cpp index 934a218f3..f117d8f75 100644 --- a/storage/tianmu/handler/ha_my_tianmu.cpp +++ b/storage/tianmu/handler/ha_my_tianmu.cpp @@ -85,8 +85,8 @@ QueryRouteTo ha_my_tianmu_query(THD *thd, LEX *lex, Query_result *&result_output try { // handle_select_ret is introduced here because in case of some exceptions // (e.g. thrown from ForbiddenMySQLQueryPath) we want to return - QueryRouteTo handle_select_ret = ha_tianmu_engine_->HandleSelect(thd, lex, result_output, setup_tables_done_option, res, - optimize_after_tianmu, tianmu_free_join, with_insert); + QueryRouteTo handle_select_ret = ha_tianmu_engine_->HandleSelect( + thd, lex, result_output, setup_tables_done_option, res, optimize_after_tianmu, tianmu_free_join, with_insert); if (handle_select_ret == QueryRouteTo::kToMySQL && AtLeastOneTianmuTableInvolved(lex) && ForbiddenMySQLQueryPath(lex)) { my_message(static_cast(common::ErrorCode::UNKNOWN_ERROR), diff --git a/storage/tianmu/handler/ha_tianmu.cpp b/storage/tianmu/handler/ha_tianmu.cpp index 8f749f5c4..ac0f0316b 100644 --- a/storage/tianmu/handler/ha_tianmu.cpp +++ b/storage/tianmu/handler/ha_tianmu.cpp @@ -1035,7 +1035,7 @@ int ha_tianmu::rnd_init(bool scan) { table_new_iter_end_ = ((core::TianmuTable *)table_ptr_)->End(); } catch (common::Exception const &e) { tianmu_control_ << system::lock << "Error in push-down execution, push-down execution aborted: " << e.what() - << system::unlock; + << system::unlock; TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught in push-down execution: %s", e.what()); } query_.reset(); @@ -1047,7 +1047,7 @@ int ha_tianmu::rnd_init(bool scan) { } else { std::shared_ptr rctp; ha_tianmu_engine_->GetTableIterator(table_name_, table_new_iter_, table_new_iter_end_, rctp, - GetAttrsUseIndicator(table), table->in_use); + GetAttrsUseIndicator(table), table->in_use); table_ptr_ = rctp.get(); filter_ptr_.reset(); } @@ -1439,7 +1439,7 @@ int ha_tianmu::set_cond_iter() { ret = 0; } catch (common::Exception const &e) { tianmu_control_ << system::lock << "Error in push-down execution, push-down execution aborted: " << e.what() - << system::unlock; + << system::unlock; TIANMU_LOG(LogCtl_Level::ERROR, "Error in push-down execution, push-down execution aborted: %s", e.what()); } query_.reset(); @@ -1456,7 +1456,7 @@ const Item *ha_tianmu::cond_push(const Item *a_cond) { if (!query_) { std::shared_ptr rctp; ha_tianmu_engine_->GetTableIterator(table_name_, table_new_iter_, table_new_iter_end_, rctp, - GetAttrsUseIndicator(table), table->in_use); + GetAttrsUseIndicator(table), table->in_use); table_ptr_ = rctp.get(); query_.reset(new core::Query(current_txn_)); cq_.reset(new core::CompiledQuery); @@ -2182,7 +2182,7 @@ extern void async_join_update(MYSQL_THD thd, struct st_mysql_sys_var *var, void #define STATUS_FUNCTION(name, show_type, member) \ int get_##name##_StatusVar([[maybe_unused]] MYSQL_THD thd, struct st_mysql_show_var *outvar, char *tmp) { \ - *((int64_t *)tmp) = ha_tianmu_engine_->cache.member(); \ + *((int64_t *)tmp) = ha_tianmu_engine_->cache.member(); \ outvar->value = tmp; \ outvar->type = show_type; \ return 0; \ diff --git a/storage/tianmu/index/rdb_meta_manager.cpp b/storage/tianmu/index/rdb_meta_manager.cpp index b80178b21..068cfd2ae 100644 --- a/storage/tianmu/index/rdb_meta_manager.cpp +++ b/storage/tianmu/index/rdb_meta_manager.cpp @@ -505,7 +505,8 @@ bool DDLManager::init(DICTManager *const dict, CFManager *const cf_manager_) { max_index_id, memtable_id); return false; } - std::shared_ptr tb_mem = std::make_shared(table_name, memtable_id, cf_id); + std::shared_ptr tb_mem = + std::make_shared(table_name, memtable_id, cf_id); mem_hash_[table_name] = tb_mem; } diff --git a/storage/tianmu/index/tianmu_table_index.cpp b/storage/tianmu/index/tianmu_table_index.cpp index abf73e738..e965cefb4 100644 --- a/storage/tianmu/index/tianmu_table_index.cpp +++ b/storage/tianmu/index/tianmu_table_index.cpp @@ -167,7 +167,7 @@ common::ErrorCode TianmuTableIndex::CheckUniqueness(core::Transaction *tx, const } common::ErrorCode TianmuTableIndex::InsertIndex(core::Transaction *tx, std::vector &fields, - uint64_t row) { + uint64_t row) { StringWriter value, key; rocksdb_key_->pack_key(key, fields, value); @@ -188,7 +188,7 @@ common::ErrorCode TianmuTableIndex::InsertIndex(core::Transaction *tx, std::vect } common::ErrorCode TianmuTableIndex::UpdateIndex(core::Transaction *tx, std::string_view &nkey, std::string_view &okey, - uint64_t row) { + uint64_t row) { StringWriter value, packkey; std::vector ofields, nfields; @@ -228,7 +228,7 @@ common::ErrorCode TianmuTableIndex::DeleteIndex(core::Transaction *tx, std::stri } common::ErrorCode TianmuTableIndex::GetRowByKey(core::Transaction *tx, std::vector &fields, - uint64_t &row) { + uint64_t &row) { std::string value; StringWriter packkey, info; rocksdb_key_->pack_key(packkey, fields, info); diff --git a/storage/tianmu/mm/huge_heap_policy.cpp b/storage/tianmu/mm/huge_heap_policy.cpp index 855de5729..bd0ec0446 100644 --- a/storage/tianmu/mm/huge_heap_policy.cpp +++ b/storage/tianmu/mm/huge_heap_policy.cpp @@ -44,7 +44,7 @@ HugeHeap::HugeHeap(std::string hugedir, size_t size) : TCMHeap(0) { if (fd_ < 0) { heap_status_ = HEAP_STATUS::HEAP_OUT_OF_MEMORY; tianmu_control_ << system::lock << "Memory Manager Error: Unable to create hugepage file: " << huge_filename_ - << system::unlock; + << system::unlock; return; } // MAP_SHARED to have mmap fail immediately if not enough pages @@ -55,7 +55,7 @@ HugeHeap::HugeHeap(std::string hugedir, size_t size) : TCMHeap(0) { unlink(huge_filename_); heap_status_ = HEAP_STATUS::HEAP_OUT_OF_MEMORY; tianmu_control_ << system::lock << "Memory Manager Error: hugepage file mmap error: " << std::strerror(errno) - << system::unlock; + << system::unlock; return; } diff --git a/storage/tianmu/mm/traceable_object.cpp b/storage/tianmu/mm/traceable_object.cpp index 4d5d1a77a..731054a16 100644 --- a/storage/tianmu/mm/traceable_object.cpp +++ b/storage/tianmu/mm/traceable_object.cpp @@ -24,8 +24,8 @@ #include "mm/release_tracker.h" #include "system/fet.h" -#include "system/tianmu_system.h" #include "system/res_manager.h" +#include "system/tianmu_system.h" namespace Tianmu { namespace mm { diff --git a/storage/tianmu/system/large_buffer.cpp b/storage/tianmu/system/large_buffer.cpp index cfd023b29..2cbc67301 100644 --- a/storage/tianmu/system/large_buffer.cpp +++ b/storage/tianmu/system/large_buffer.cpp @@ -22,8 +22,8 @@ #include "common/assert.h" #include "core/tools.h" #include "system/io_parameters.h" -#include "system/tianmu_system.h" #include "system/tianmu_file.h" +#include "system/tianmu_system.h" namespace Tianmu { namespace system { diff --git a/storage/tianmu/types/bstring.cpp b/storage/tianmu/types/bstring.cpp index 679b0569d..f01ab2ef2 100644 --- a/storage/tianmu/types/bstring.cpp +++ b/storage/tianmu/types/bstring.cpp @@ -53,7 +53,8 @@ BString::BString(const char *v, size_t length, bool persistent) : persistent_(pe } } -BString::BString(const BString &tianmu_bs) : ValueBasic(tianmu_bs), pos_(tianmu_bs.pos_), persistent_(tianmu_bs.persistent_) { +BString::BString(const BString &tianmu_bs) + : ValueBasic(tianmu_bs), pos_(tianmu_bs.pos_), persistent_(tianmu_bs.persistent_) { null_ = tianmu_bs.null_; if (!null_) { len_ = tianmu_bs.len_; diff --git a/storage/tianmu/types/tianmu_data_types.cpp b/storage/tianmu/types/tianmu_data_types.cpp index 3a80ee5ad..08d355661 100644 --- a/storage/tianmu/types/tianmu_data_types.cpp +++ b/storage/tianmu/types/tianmu_data_types.cpp @@ -25,7 +25,9 @@ namespace types { TianmuDataType::~TianmuDataType() {} -bool TianmuDataType::AreComperable(const TianmuDataType &tianmu_dt) const { return TianmuDataType::AreComperable(*this, tianmu_dt); } +bool TianmuDataType::AreComperable(const TianmuDataType &tianmu_dt) const { + return TianmuDataType::AreComperable(*this, tianmu_dt); +} bool TianmuDataType::AreComperable(const TianmuDataType &tianmu_dt1, const TianmuDataType &tianmu_dt2) { common::CT att1 = tianmu_dt1.Type(); @@ -33,7 +35,8 @@ bool TianmuDataType::AreComperable(const TianmuDataType &tianmu_dt1, const Tianm return AreComparable(att1, att2); } -bool TianmuDataType::compare(const TianmuDataType &tianmu_dt1, const TianmuDataType &tianmu_dt2, common::Operator op, char like_esc) { +bool TianmuDataType::compare(const TianmuDataType &tianmu_dt1, const TianmuDataType &tianmu_dt2, common::Operator op, + char like_esc) { // DEBUG_ASSERT(TianmuDataType::AreComperable(tianmu_dt1, tianmu_dt2)); if (op == common::Operator::O_LIKE || op == common::Operator::O_NOT_LIKE) { if (tianmu_dt1.IsNull() || tianmu_dt2.IsNull()) diff --git a/storage/tianmu/types/tianmu_data_types.h b/storage/tianmu/types/tianmu_data_types.h index 88a8dfb7d..1ea62bb9d 100644 --- a/storage/tianmu/types/tianmu_data_types.h +++ b/storage/tianmu/types/tianmu_data_types.h @@ -169,7 +169,8 @@ class TianmuDataType { static bool ToReal(const TianmuDataType &in, TianmuNum &out); static bool AreComperable(const TianmuDataType &tianmu_dt1, const TianmuDataType &tianmu_dt2); - static bool compare(const TianmuDataType &tianmu_dt1, const TianmuDataType &tianmu_dt2, common::Operator op, char like_esc); + static bool compare(const TianmuDataType &tianmu_dt1, const TianmuDataType &tianmu_dt2, common::Operator op, + char like_esc); }; template @@ -300,7 +301,7 @@ class TianmuDateTime : public ValueBasic { TianmuDateTime(int64_t dt, common::CT at); TianmuDateTime(short year = common::NULL_VALUE_SH); TianmuDateTime(short year, short month, short day, short hour, short minute, short second, - common::CT at); // DataTime , Timestamp + common::CT at); // DataTime , Timestamp TianmuDateTime(short yh, short mm, short ds, common::CT at); // Date or Time TianmuDateTime(const TianmuDateTime &tianmu_dt); TianmuDateTime(const MYSQL_TIME &myt, common::CT at); @@ -446,7 +447,8 @@ class TianmuValueObject { std::unique_ptr value_; public: - static bool compare(const TianmuValueObject &tianmu_value_obj1, const TianmuValueObject &tianmu_value_obj2, common::Operator op, char like_esc); + static bool compare(const TianmuValueObject &tianmu_value_obj1, const TianmuValueObject &tianmu_value_obj2, + common::Operator op, char like_esc); }; template diff --git a/storage/tianmu/types/tianmu_datetime.cpp b/storage/tianmu/types/tianmu_datetime.cpp index 959c0899d..ca77cce25 100644 --- a/storage/tianmu/types/tianmu_datetime.cpp +++ b/storage/tianmu/types/tianmu_datetime.cpp @@ -69,7 +69,8 @@ TianmuDateTime::TianmuDateTime(short yh, short mm, short ds, common::CT at) : at TIANMU_ERROR("type not supported"); } -TianmuDateTime::TianmuDateTime(short year, short month, short day, short hour, short minute, short second, common::CT at) +TianmuDateTime::TianmuDateTime(short year, short month, short day, short hour, short minute, short second, + common::CT at) : at_(at) { ASSERT(at == common::CT::DATETIME || at == common::CT::TIMESTAMP || at == common::CT::DATE, "should be 'at == common::CT::DATETIME || at == common::CT::TIMESTAMP || at == common::CT::DATE'"); @@ -108,7 +109,9 @@ TianmuDateTime::TianmuDateTime(TianmuNum &tianmu_n, common::CT at) : at_(at) { } } -TianmuDateTime::TianmuDateTime(const TianmuDateTime &tianmu_dt) : ValueBasic(tianmu_dt) { *this = tianmu_dt; } +TianmuDateTime::TianmuDateTime(const TianmuDateTime &tianmu_dt) : ValueBasic(tianmu_dt) { + *this = tianmu_dt; +} TianmuDateTime::~TianmuDateTime() {} @@ -373,9 +376,10 @@ bool TianmuDateTime::CanBeTime(int64_t hour, int64_t minute, int64_t second) { } bool TianmuDateTime::CanBeTimestamp(int64_t year, int64_t month, int64_t day, int64_t hour, int64_t minute, - int64_t second) { - if (year == kTianmuTimestampSpec.Year() && month == kTianmuTimestampSpec.Month() && day == kTianmuTimestampSpec.Day() && - hour == kTianmuTimestampSpec.Hour() && minute == kTianmuTimestampSpec.Minute() && second == kTianmuTimestampSpec.Second()) + int64_t second) { + if (year == kTianmuTimestampSpec.Year() && month == kTianmuTimestampSpec.Month() && + day == kTianmuTimestampSpec.Day() && hour == kTianmuTimestampSpec.Hour() && + minute == kTianmuTimestampSpec.Minute() && second == kTianmuTimestampSpec.Second()) return true; if (CanBeYear(year) && CanBeMonth(month) && (day > 0 && (day <= NoDaysInMonth((ushort)year, (ushort)month))) && CanBeHour(hour) && CanBeMinute(minute) && CanBeSecond(second)) @@ -383,9 +387,11 @@ bool TianmuDateTime::CanBeTimestamp(int64_t year, int64_t month, int64_t day, in return false; } -bool TianmuDateTime::CanBeDatetime(int64_t year, int64_t month, int64_t day, int64_t hour, int64_t minute, int64_t second) { +bool TianmuDateTime::CanBeDatetime(int64_t year, int64_t month, int64_t day, int64_t hour, int64_t minute, + int64_t second) { if (year == kTianmuDatetimeSpec.Year() && month == kTianmuDatetimeSpec.Month() && day == kTianmuDatetimeSpec.Day() && - hour == kTianmuDatetimeSpec.Hour() && minute == kTianmuDatetimeSpec.Minute() && second == kTianmuDatetimeSpec.Second()) + hour == kTianmuDatetimeSpec.Hour() && minute == kTianmuDatetimeSpec.Minute() && + second == kTianmuDatetimeSpec.Second()) return true; if (CanBeYear(year) && CanBeMonth(month) && (day > 0 && (day <= NoDaysInMonth((ushort)year, (ushort)month))) && CanBeHour(hour) && CanBeMinute(minute) && CanBeSecond(second)) @@ -394,7 +400,8 @@ bool TianmuDateTime::CanBeDatetime(int64_t year, int64_t month, int64_t day, int } bool TianmuDateTime::IsCorrectTianmuYear(short year) { - return year == kTianmuYearSpec.Year() || (CanBeYear(year) && (year >= kTianmuYearMin.Year() && year <= kTianmuYearMax.Year())); + return year == kTianmuYearSpec.Year() || + (CanBeYear(year) && (year >= kTianmuYearMin.Year() && year <= kTianmuYearMax.Year())); } bool TianmuDateTime::IsCorrectTianmuDate(short year, short month, short day) { @@ -421,15 +428,17 @@ bool TianmuDateTime::IsCorrectTianmuTime(short hour, short minute, short second) if (hasnegative == haspositive && (hour != 0 || minute != 0 || second != 0)) return false; - if (hour >= -kTianmuTimeMin.Hour() && hour <= kTianmuTimeMax.Hour() && (CanBeMinute(minute) || CanBeMinute(-minute)) && - (CanBeSecond(second) || CanBeSecond(-second))) + if (hour >= -kTianmuTimeMin.Hour() && hour <= kTianmuTimeMax.Hour() && + (CanBeMinute(minute) || CanBeMinute(-minute)) && (CanBeSecond(second) || CanBeSecond(-second))) return true; return false; } -bool TianmuDateTime::IsCorrectTianmuTimestamp(short year, short month, short day, short hour, short minute, short second) { - if (year == kTianmuTimestampSpec.Year() && month == kTianmuTimestampSpec.Month() && day == kTianmuTimestampSpec.Day() && - hour == kTianmuTimestampSpec.Hour() && minute == kTianmuTimestampSpec.Minute() && second == kTianmuTimestampSpec.Second()) +bool TianmuDateTime::IsCorrectTianmuTimestamp(short year, short month, short day, short hour, short minute, + short second) { + if (year == kTianmuTimestampSpec.Year() && month == kTianmuTimestampSpec.Month() && + day == kTianmuTimestampSpec.Day() && hour == kTianmuTimestampSpec.Hour() && + minute == kTianmuTimestampSpec.Minute() && second == kTianmuTimestampSpec.Second()) return true; if (CanBeYear(year) && CanBeMonth(month) && (day > 0 && (day <= NoDaysInMonth(year, month))) && CanBeHour(hour) && CanBeMinute(minute) && CanBeSecond(second)) { @@ -440,16 +449,20 @@ bool TianmuDateTime::IsCorrectTianmuTimestamp(short year, short month, short day return false; } -bool TianmuDateTime::IsCorrectTianmuDatetime(short year, short month, short day, short hour, short minute, short second) { +bool TianmuDateTime::IsCorrectTianmuDatetime(short year, short month, short day, short hour, short minute, + short second) { if (year == kTianmuDatetimeSpec.Year() && month == kTianmuDatetimeSpec.Month() && day == kTianmuDatetimeSpec.Day() && - hour == kTianmuDatetimeSpec.Hour() && minute == kTianmuDatetimeSpec.Minute() && second == kTianmuDatetimeSpec.Second()) + hour == kTianmuDatetimeSpec.Hour() && minute == kTianmuDatetimeSpec.Minute() && + second == kTianmuDatetimeSpec.Second()) return true; if (CanBeYear(year) && CanBeMonth(month) && (day > 0 && (day <= NoDaysInMonth(year, month))) && CanBeHour(hour) && CanBeMinute(minute) && CanBeSecond(second)) { if ((year >= kTianmuDatetimeMin.Year() && month >= kTianmuDatetimeMin.Month() && day >= kTianmuDatetimeMin.Day() && - hour >= kTianmuDatetimeMin.Hour() && minute >= kTianmuDatetimeMin.Minute() && second >= kTianmuDatetimeMin.Second()) && + hour >= kTianmuDatetimeMin.Hour() && minute >= kTianmuDatetimeMin.Minute() && + second >= kTianmuDatetimeMin.Second()) && (year <= kTianmuDatetimeMax.Year() && month <= kTianmuDatetimeMax.Month() && day <= kTianmuDatetimeMax.Day() && - hour <= kTianmuDatetimeMax.Hour() && minute <= kTianmuDatetimeMax.Minute() && second <= kTianmuDatetimeMax.Second())) + hour <= kTianmuDatetimeMax.Hour() && minute <= kTianmuDatetimeMax.Minute() && + second <= kTianmuDatetimeMax.Second())) return true; } return false; @@ -523,7 +536,7 @@ TianmuDateTime TianmuDateTime::GetCurrent() { time_t const curr = time(0); tm const tmt = *localtime(&curr); TianmuDateTime tianmu_dt(tmt.tm_year + 1900, tmt.tm_mon + 1, tmt.tm_mday, tmt.tm_hour, tmt.tm_min, tmt.tm_sec, - common::CT::DATETIME); + common::CT::DATETIME); return tianmu_dt; } @@ -687,7 +700,7 @@ void TianmuDateTime::AdjustTimezone(TianmuDateTime &dt) { gmtime_r(&secs, &utc_t); // UTC time stored on server dt = TianmuDateTime((utc_t.tm_year + 1900) % 10000, utc_t.tm_mon + 1, utc_t.tm_mday, utc_t.tm_hour, utc_t.tm_min, - utc_t.tm_sec, common::CT::TIMESTAMP); + utc_t.tm_sec, common::CT::TIMESTAMP); dt.dt_.microsecond = t.second_part; } } diff --git a/storage/tianmu/types/tianmu_num.cpp b/storage/tianmu/types/tianmu_num.cpp index 5fcdb83a8..f4ab67f90 100644 --- a/storage/tianmu/types/tianmu_num.cpp +++ b/storage/tianmu/types/tianmu_num.cpp @@ -486,8 +486,9 @@ int TianmuNum::compare(const TianmuNum &tianmu_n) const { return false; if (IsReal() || tianmu_n.IsReal()) { if (IsReal() && tianmu_n.IsReal()) - return (*(double *)&value_ > *(double *)&tianmu_n.value_ ? 1 - : (*(double *)&value_ == *(double *)&tianmu_n.value_ ? 0 : -1)); + return (*(double *)&value_ > *(double *)&tianmu_n.value_ + ? 1 + : (*(double *)&value_ == *(double *)&tianmu_n.value_ ? 0 : -1)); else { if (IsReal()) return (*this > tianmu_n.ToReal() ? 1 : (*this == tianmu_n.ToReal() ? 0 : -1)); diff --git a/storage/tianmu/types/tianmu_value_object.cpp b/storage/tianmu/types/tianmu_value_object.cpp index 33953447d..bd30bd5d0 100644 --- a/storage/tianmu/types/tianmu_value_object.cpp +++ b/storage/tianmu/types/tianmu_value_object.cpp @@ -41,8 +41,8 @@ TianmuValueObject &TianmuValueObject::operator=(const TianmuValueObject &tianmu_ inline void TianmuValueObject::construct(const TianmuDataType &tianmu_dt) { value_ = tianmu_dt.Clone(); } -bool TianmuValueObject::compare(const TianmuValueObject &tianmu_value_obj1, const TianmuValueObject &tianmu_value_obj2, common::Operator op, - char like_esc) { +bool TianmuValueObject::compare(const TianmuValueObject &tianmu_value_obj1, const TianmuValueObject &tianmu_value_obj2, + common::Operator op, char like_esc) { if (tianmu_value_obj1.IsNull() || tianmu_value_obj2.IsNull()) return false; else diff --git a/storage/tianmu/types/value_parser4txt.cpp b/storage/tianmu/types/value_parser4txt.cpp index d298993e8..7947a4813 100644 --- a/storage/tianmu/types/value_parser4txt.cpp +++ b/storage/tianmu/types/value_parser4txt.cpp @@ -597,7 +597,8 @@ common::ErrorCode ValueParserForText::ParseBigIntAdapter(const BString &tianmu_s return return_code; } -common::ErrorCode ValueParserForText::ParseDecimal(BString const &tianmu_s, int64_t &out, short precision, short scale) { +common::ErrorCode ValueParserForText::ParseDecimal(BString const &tianmu_s, int64_t &out, short precision, + short scale) { TianmuNum number; common::ErrorCode return_code = ParseNum(tianmu_s, number, scale); out = number.ValueInt(); @@ -611,7 +612,8 @@ common::ErrorCode ValueParserForText::ParseDecimal(BString const &tianmu_s, int6 return return_code; } -common::ErrorCode ValueParserForText::ParseDateTimeOrTimestamp(const BString &tianmu_s, TianmuDateTime &rcv, common::CT at) { +common::ErrorCode ValueParserForText::ParseDateTimeOrTimestamp(const BString &tianmu_s, TianmuDateTime &rcv, + common::CT at) { if (tianmu_s.IsNull() || tianmu_s.Equals("nullptr", 4)) { rcv.at_ = at; rcv.null_ = true; @@ -691,15 +693,16 @@ common::ErrorCode ValueParserForText::ParseDateTimeOrTimestamp(const BString &ti if (!EatWhiteSigns(buf, buflen) && !system::EatDTSeparators(buf, buflen)) { if ((at == common::CT::DATETIME && TianmuDateTime::IsCorrectTianmuDatetime((short)year, month, day, TianmuDateTime::GetSpecialValue(at).Hour(), - TianmuDateTime::GetSpecialValue(at).Minute(), - TianmuDateTime::GetSpecialValue(at).Second())) || + TianmuDateTime::GetSpecialValue(at).Minute(), + TianmuDateTime::GetSpecialValue(at).Second())) || (at == common::CT::TIMESTAMP && TianmuDateTime::IsCorrectTianmuTimestamp((short)year, month, day, TianmuDateTime::GetSpecialValue(at).Hour(), - TianmuDateTime::GetSpecialValue(at).Minute(), - TianmuDateTime::GetSpecialValue(at).Second())) || + TianmuDateTime::GetSpecialValue(at).Minute(), + TianmuDateTime::GetSpecialValue(at).Second())) || (at == common::CT::DATE && TianmuDateTime::IsCorrectTianmuDate((short)year, month, day))) rcv = TianmuDateTime((short)year, month, day, TianmuDateTime::GetSpecialValue(at).Hour(), - TianmuDateTime::GetSpecialValue(at).Minute(), TianmuDateTime::GetSpecialValue(at).Second(), at); + TianmuDateTime::GetSpecialValue(at).Minute(), TianmuDateTime::GetSpecialValue(at).Second(), + at); return common::ErrorCode::OUT_OF_RANGE; } @@ -762,18 +765,18 @@ common::ErrorCode ValueParserForText::ParseDateTimeOrTimestamp(const BString &ti try { if (at == common::CT::DATETIME) { if (TianmuDateTime::IsCorrectTianmuDatetime((short)year, (short)month, (short)day, (short)hour, (short)minute, - (short)second)) { + (short)second)) { rcv = TianmuDateTime((short)year, (short)month, (short)day, (short)hour, (short)minute, (short)second, at); return tianmu_err_code; } else { rcv = TianmuDateTime((short)year, (short)month, (short)day, (short)TianmuDateTime::GetSpecialValue(at).Hour(), - (short)TianmuDateTime::GetSpecialValue(at).Minute(), - (short)TianmuDateTime::GetSpecialValue(at).Second(), at); + (short)TianmuDateTime::GetSpecialValue(at).Minute(), + (short)TianmuDateTime::GetSpecialValue(at).Second(), at); tianmu_err_code = common::ErrorCode::OUT_OF_RANGE; } } else if (at == common::CT::TIMESTAMP) { if (TianmuDateTime::IsCorrectTianmuTimestamp((short)year, (short)month, (short)day, (short)hour, (short)minute, - (short)second)) { + (short)second)) { // convert to UTC MYSQL_TIME myt; std::memset(&myt, 0, sizeof(MYSQL_TIME)); diff --git a/storage/tianmu/vc/const_column.cpp b/storage/tianmu/vc/const_column.cpp index 71e5fa1fc..c07e141b9 100644 --- a/storage/tianmu/vc/const_column.cpp +++ b/storage/tianmu/vc/const_column.cpp @@ -101,7 +101,7 @@ double ConstColumn::GetValueDoubleImpl([[maybe_unused]] const core::MIIterator & val = u.d; } else if (core::ATI::IsDateTimeType(TypeName())) { types::TianmuDateTime vd(value_or_null_.Get64(), - TypeName()); // 274886765314048 -> 2000-01-01 + TypeName()); // 274886765314048 -> 2000-01-01 int64_t vd_conv = 0; vd.ToInt64(vd_conv); // 2000-01-01 -> 20000101 val = (double)vd_conv; diff --git a/storage/tianmu/vc/const_expr_column.cpp b/storage/tianmu/vc/const_expr_column.cpp index 93c65ddb4..20474e196 100644 --- a/storage/tianmu/vc/const_expr_column.cpp +++ b/storage/tianmu/vc/const_expr_column.cpp @@ -52,7 +52,7 @@ double ConstExpressionColumn::GetValueDoubleImpl([[maybe_unused]] const core::MI val = u.d; } else if (core::ATI::IsDateTimeType(TypeName())) { types::TianmuDateTime vd(last_val_->Get64(), - TypeName()); // 274886765314048 -> 2000-01-01 + TypeName()); // 274886765314048 -> 2000-01-01 int64_t vd_conv = 0; vd.ToInt64(vd_conv); // 2000-01-01 -> 20000101 val = (double)vd_conv; @@ -66,7 +66,7 @@ double ConstExpressionColumn::GetValueDoubleImpl([[maybe_unused]] const core::MI } types::TianmuValueObject ConstExpressionColumn::GetValueImpl([[maybe_unused]] const core::MIIterator &mit, - bool lookup_to_num) { + bool lookup_to_num) { if (last_val_->IsNull()) return types::TianmuValueObject(); diff --git a/storage/tianmu/vc/expr_column.cpp b/storage/tianmu/vc/expr_column.cpp index b87dfc56b..972525a3e 100644 --- a/storage/tianmu/vc/expr_column.cpp +++ b/storage/tianmu/vc/expr_column.cpp @@ -155,7 +155,7 @@ double ExpressionColumn::GetValueDoubleImpl(const core::MIIterator &mit) { val = last_val_->GetDouble(); } else if (core::ATI::IsDateTimeType(TypeName())) { types::TianmuDateTime vd(last_val_->Get64(), - TypeName()); // 274886765314048 -> 2000-01-01 + TypeName()); // 274886765314048 -> 2000-01-01 int64_t vd_conv = 0; vd.ToInt64(vd_conv); // 2000-01-01 -> 20000101 val = (double)vd_conv; diff --git a/storage/tianmu/vc/multi_value_column.h b/storage/tianmu/vc/multi_value_column.h index faf39b341..afbd4e154 100644 --- a/storage/tianmu/vc/multi_value_column.h +++ b/storage/tianmu/vc/multi_value_column.h @@ -206,7 +206,7 @@ class MultiValColumn : public VirtualColumn { DEBUG_ASSERT(!"Invalid call for this type of column."); } types::TianmuValueObject GetValueImpl([[maybe_unused]] const core::MIIterator &mit, - [[maybe_unused]] bool lookup_to_num) override { + [[maybe_unused]] bool lookup_to_num) override { DEBUG_ASSERT(!"Invalid call for this type of column."); return (types::TianmuValueObject()); } diff --git a/storage/tianmu/vc/subselect_column.cpp b/storage/tianmu/vc/subselect_column.cpp index 3e4a4a95e..d0df50141 100644 --- a/storage/tianmu/vc/subselect_column.cpp +++ b/storage/tianmu/vc/subselect_column.cpp @@ -444,7 +444,8 @@ bool SubSelectColumn::IsNullImpl(const core::MIIterator &mit) { return tmp_tab_subq_ptr_->IsNull(0, col_idx_); } -types::TianmuValueObject SubSelectColumn::GetValueImpl(const core::MIIterator &mit, [[maybe_unused]] bool lookup_to_num) { +types::TianmuValueObject SubSelectColumn::GetValueImpl(const core::MIIterator &mit, + [[maybe_unused]] bool lookup_to_num) { PrepareSubqResult(mit, false); types::TianmuValueObject val = tmp_tab_subq_ptr_->GetValueObject(0, col_idx_); if (expected_type_.IsString()) diff --git a/storage/tianmu/vc/type_cast_column.cpp b/storage/tianmu/vc/type_cast_column.cpp index 70cf811fa..adb2dc616 100644 --- a/storage/tianmu/vc/type_cast_column.cpp +++ b/storage/tianmu/vc/type_cast_column.cpp @@ -454,7 +454,8 @@ DateTime2VarcharCastColumn::DateTime2VarcharCastColumn(VirtualColumn *from, core } } -types::TianmuValueObject DateTime2VarcharCastColumn::GetValueImpl(const core::MIIterator &mit, [[maybe_unused]] bool b) { +types::TianmuValueObject DateTime2VarcharCastColumn::GetValueImpl(const core::MIIterator &mit, + [[maybe_unused]] bool b) { if (full_const_) return rc_value_obj_; else { @@ -645,7 +646,8 @@ int64_t TimeZoneConversionCastColumn::GetValueInt64Impl(const core::MIIterator & } } -types::TianmuValueObject TimeZoneConversionCastColumn::GetValueImpl(const core::MIIterator &mit, [[maybe_unused]] bool b) { +types::TianmuValueObject TimeZoneConversionCastColumn::GetValueImpl(const core::MIIterator &mit, + [[maybe_unused]] bool b) { if (full_const_) { if (Type().IsString()) return rc_value_obj_.ToBString(); @@ -694,7 +696,8 @@ void TimeZoneConversionCastColumn::GetValueStringImpl(types::BString &s, const c } } -types::TianmuValueObject StringCastColumn::GetValueImpl(const core::MIIterator &mit, [[maybe_unused]] bool lookup_to_num) { +types::TianmuValueObject StringCastColumn::GetValueImpl(const core::MIIterator &mit, + [[maybe_unused]] bool lookup_to_num) { types::BString s; vc_->GetValueString(s, mit); return s;