|
26 | 26 | #include "catalog/table_metrics_catalog.h"
|
27 | 27 | #include "catalog/trigger_catalog.h"
|
28 | 28 | #include "concurrency/transaction_manager_factory.h"
|
| 29 | +#include "executor/executor_context.h" |
29 | 30 | #include "function/date_functions.h"
|
30 | 31 | #include "function/decimal_functions.h"
|
31 | 32 | #include "function/old_engine_string_functions.h"
|
|
34 | 35 | #include "settings/settings_manager.h"
|
35 | 36 | #include "storage/storage_manager.h"
|
36 | 37 | #include "storage/table_factory.h"
|
| 38 | +#include "storage/tile.h" |
37 | 39 | #include "type/ephemeral_pool.h"
|
38 | 40 |
|
39 | 41 | namespace peloton {
|
@@ -148,12 +150,12 @@ void Catalog::Bootstrap() {
|
148 | 150 | DatabaseMetricsCatalog::GetInstance(txn);
|
149 | 151 | TableMetricsCatalog::GetInstance(txn);
|
150 | 152 | IndexMetricsCatalog::GetInstance(txn);
|
151 |
| - QueryMetricsCatalog::GetInstance(txn); |
| 153 | + QueryMetricsCatalog::GetInstance(txn); |
152 | 154 | SettingsCatalog::GetInstance(txn);
|
153 | 155 | TriggerCatalog::GetInstance(txn);
|
154 | 156 | LanguageCatalog::GetInstance(txn);
|
155 | 157 | ProcCatalog::GetInstance(txn);
|
156 |
| - |
| 158 | + |
157 | 159 | if (settings::SettingsManager::GetBool(settings::SettingId::brain)) {
|
158 | 160 | QueryHistoryCatalog::GetInstance(txn);
|
159 | 161 | }
|
@@ -614,18 +616,18 @@ ResultType Catalog::DropIndex(oid_t index_oid,
|
614 | 616 |
|
615 | 617 | ResultType Catalog::DropIndex(const std::string &index_name,
|
616 | 618 | concurrency::TransactionContext *txn) {
|
617 |
| - if(txn == nullptr) { |
618 |
| - throw CatalogException("Do not have transaction to drop index " + |
619 |
| - index_name); |
620 |
| - } |
621 |
| - auto index_object = catalog::IndexCatalog::GetInstance()->GetIndexObject( |
622 |
| - index_name, txn); |
623 |
| - if(index_object == nullptr) { |
624 |
| - throw CatalogException("Index name " + index_name + " cannot be found"); |
625 |
| - } |
626 |
| - ResultType result = DropIndex(index_object->GetIndexOid(), txn); |
| 619 | + if (txn == nullptr) { |
| 620 | + throw CatalogException("Do not have transaction to drop index " + |
| 621 | + index_name); |
| 622 | + } |
| 623 | + auto index_object = |
| 624 | + catalog::IndexCatalog::GetInstance()->GetIndexObject(index_name, txn); |
| 625 | + if (index_object == nullptr) { |
| 626 | + throw CatalogException("Index name " + index_name + " cannot be found"); |
| 627 | + } |
| 628 | + ResultType result = DropIndex(index_object->GetIndexOid(), txn); |
627 | 629 |
|
628 |
| - return result; |
| 630 | + return result; |
629 | 631 | }
|
630 | 632 |
|
631 | 633 | //===--------------------------------------------------------------------===//
|
@@ -866,7 +868,7 @@ ResultType Catalog::ChangeColumnName(const std::string &database_name,
|
866 | 868 | table_oid, new_column.GetName(), columnId, new_column.GetOffset(),
|
867 | 869 | new_column.GetType(), new_column.IsInlined(),
|
868 | 870 | new_column.GetConstraints(), pool_.get(), txn);
|
869 |
| - |
| 871 | + |
870 | 872 | } catch (CatalogException &e) {
|
871 | 873 | return ResultType::FAILURE;
|
872 | 874 | }
|
@@ -1150,11 +1152,11 @@ void Catalog::InitializeFunctions() {
|
1150 | 1152 | /**
|
1151 | 1153 | * decimal functions
|
1152 | 1154 | */
|
1153 |
| - AddBuiltinFunction( |
1154 |
| - "abs", {type::TypeId::DECIMAL}, type::TypeId::DECIMAL, internal_lang, |
1155 |
| - "Abs", function::BuiltInFuncType{OperatorId::Abs, |
1156 |
| - function::DecimalFunctions::_Abs}, |
1157 |
| - txn); |
| 1155 | + AddBuiltinFunction("abs", {type::TypeId::DECIMAL}, type::TypeId::DECIMAL, |
| 1156 | + internal_lang, "Abs", |
| 1157 | + function::BuiltInFuncType{ |
| 1158 | + OperatorId::Abs, function::DecimalFunctions::_Abs}, |
| 1159 | + txn); |
1158 | 1160 | AddBuiltinFunction(
|
1159 | 1161 | "sqrt", {type::TypeId::TINYINT}, type::TypeId::DECIMAL, internal_lang,
|
1160 | 1162 | "Sqrt", function::BuiltInFuncType{OperatorId::Sqrt,
|
@@ -1191,33 +1193,29 @@ void Catalog::InitializeFunctions() {
|
1191 | 1193 | /**
|
1192 | 1194 | * integer functions
|
1193 | 1195 | */
|
1194 |
| - AddBuiltinFunction( |
1195 |
| - "abs", {type::TypeId::TINYINT}, type::TypeId::TINYINT, |
1196 |
| - internal_lang, "Abs", |
1197 |
| - function::BuiltInFuncType{OperatorId::Abs, |
1198 |
| - function::DecimalFunctions::_Abs}, |
1199 |
| - txn); |
| 1196 | + AddBuiltinFunction("abs", {type::TypeId::TINYINT}, type::TypeId::TINYINT, |
| 1197 | + internal_lang, "Abs", |
| 1198 | + function::BuiltInFuncType{ |
| 1199 | + OperatorId::Abs, function::DecimalFunctions::_Abs}, |
| 1200 | + txn); |
1200 | 1201 |
|
1201 |
| - AddBuiltinFunction( |
1202 |
| - "abs", {type::TypeId::SMALLINT}, type::TypeId::SMALLINT, |
1203 |
| - internal_lang, "Abs", |
1204 |
| - function::BuiltInFuncType{OperatorId::Abs, |
1205 |
| - function::DecimalFunctions::_Abs}, |
1206 |
| - txn); |
| 1202 | + AddBuiltinFunction("abs", {type::TypeId::SMALLINT}, |
| 1203 | + type::TypeId::SMALLINT, internal_lang, "Abs", |
| 1204 | + function::BuiltInFuncType{ |
| 1205 | + OperatorId::Abs, function::DecimalFunctions::_Abs}, |
| 1206 | + txn); |
1207 | 1207 |
|
1208 |
| - AddBuiltinFunction( |
1209 |
| - "abs", {type::TypeId::INTEGER}, type::TypeId::INTEGER, |
1210 |
| - internal_lang, "Abs", |
1211 |
| - function::BuiltInFuncType{OperatorId::Abs, |
1212 |
| - function::DecimalFunctions::_Abs}, |
1213 |
| - txn); |
| 1208 | + AddBuiltinFunction("abs", {type::TypeId::INTEGER}, type::TypeId::INTEGER, |
| 1209 | + internal_lang, "Abs", |
| 1210 | + function::BuiltInFuncType{ |
| 1211 | + OperatorId::Abs, function::DecimalFunctions::_Abs}, |
| 1212 | + txn); |
1214 | 1213 |
|
1215 |
| - AddBuiltinFunction( |
1216 |
| - "abs", {type::TypeId::BIGINT}, type::TypeId::BIGINT, |
1217 |
| - internal_lang, "Abs", |
1218 |
| - function::BuiltInFuncType{OperatorId::Abs, |
1219 |
| - function::DecimalFunctions::_Abs}, |
1220 |
| - txn); |
| 1214 | + AddBuiltinFunction("abs", {type::TypeId::BIGINT}, type::TypeId::BIGINT, |
| 1215 | + internal_lang, "Abs", |
| 1216 | + function::BuiltInFuncType{ |
| 1217 | + OperatorId::Abs, function::DecimalFunctions::_Abs}, |
| 1218 | + txn); |
1221 | 1219 |
|
1222 | 1220 | AddBuiltinFunction(
|
1223 | 1221 | "floor", {type::TypeId::INTEGER}, type::TypeId::DECIMAL,
|
|
0 commit comments