Skip to content

Commit 34f3c05

Browse files
dingshilunDean Chen
authored andcommitted
Revert "Merge pull request #1 from DeanChensj/catlog"
This reverts commit 6704d0e, reversing changes made to 39fa518.
1 parent d122913 commit 34f3c05

File tree

7 files changed

+33
-72
lines changed

7 files changed

+33
-72
lines changed

src/catalog/catalog.cpp

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@
3333
#include "function/old_engine_string_functions.h"
3434
#include "function/timestamp_functions.h"
3535
#include "index/index_factory.h"
36-
#include "planner/seq_scan_plan.h"
37-
#include "planner/insert_plan.h"
3836
#include "settings/settings_manager.h"
3937
#include "storage/storage_manager.h"
4038
#include "storage/table_factory.h"
41-
#include "storage/tile.h"
4239
#include "type/ephemeral_pool.h"
4340

4441
namespace peloton {
@@ -957,7 +954,6 @@ ResultType Catalog::AddColumn(
957954
return ResultType::SUCCESS;
958955
}
959956

960-
<<<<<<< bc9252fda7aeecaeb325a11f30bc23a27569f932
961957
ResultType Catalog::DropColumn(
962958
UNUSED_ATTRIBUTE const std::string &database_name,
963959
UNUSED_ATTRIBUTE const std::string &table_name,
@@ -971,13 +967,6 @@ ResultType Catalog::ChangeColumnName(const std::string &database_name,
971967
const std::vector<std::string> &old_names,
972968
const std::vector<std::string> &names,
973969
concurrency::TransactionContext *txn) {
974-
=======
975-
ResultType ChangeColumnName(const std::string &database_name,
976-
const std::string &table_name,
977-
const std::vector<std::string> &old_names,
978-
const std::vector<std::string> &names,
979-
concurrency::TransactionContext *txn) {
980-
>>>>>>> add change column catalog
981970
if (txn == nullptr) {
982971
throw CatalogException("Change Column requires transaction.");
983972
}
@@ -986,12 +975,8 @@ ResultType ChangeColumnName(const std::string &database_name,
986975
throw CatalogException("No names are given.");
987976
}
988977

989-
<<<<<<< bc9252fda7aeecaeb325a11f30bc23a27569f932
990978
LOG_TRACE("Change Column Name %s to %s", old_names[0].c_str(),
991979
names[0].c_str());
992-
=======
993-
LOG_TRACE("Change Column Name %s to %s", old_names[0], names[0]);
994-
>>>>>>> add change column catalog
995980

996981
try {
997982
// Get table from the name
@@ -1310,11 +1295,11 @@ void Catalog::InitializeFunctions() {
13101295
/**
13111296
* decimal functions
13121297
*/
1313-
AddBuiltinFunction("abs", {type::TypeId::DECIMAL}, type::TypeId::DECIMAL,
1314-
internal_lang, "Abs",
1315-
function::BuiltInFuncType{
1316-
OperatorId::Abs, function::DecimalFunctions::_Abs},
1317-
txn);
1298+
AddBuiltinFunction(
1299+
"abs", {type::TypeId::DECIMAL}, type::TypeId::DECIMAL, internal_lang,
1300+
"Abs", function::BuiltInFuncType{OperatorId::Abs,
1301+
function::DecimalFunctions::_Abs},
1302+
txn);
13181303
AddBuiltinFunction(
13191304
"sqrt", {type::TypeId::TINYINT}, type::TypeId::DECIMAL, internal_lang,
13201305
"Sqrt",
@@ -1355,29 +1340,33 @@ void Catalog::InitializeFunctions() {
13551340
/**
13561341
* integer functions
13571342
*/
1358-
AddBuiltinFunction("abs", {type::TypeId::TINYINT}, type::TypeId::TINYINT,
1359-
internal_lang, "Abs",
1360-
function::BuiltInFuncType{
1361-
OperatorId::Abs, function::DecimalFunctions::_Abs},
1362-
txn);
1343+
AddBuiltinFunction(
1344+
"abs", {type::TypeId::TINYINT}, type::TypeId::TINYINT,
1345+
internal_lang, "Abs",
1346+
function::BuiltInFuncType{OperatorId::Abs,
1347+
function::DecimalFunctions::_Abs},
1348+
txn);
13631349

1364-
AddBuiltinFunction("abs", {type::TypeId::SMALLINT},
1365-
type::TypeId::SMALLINT, internal_lang, "Abs",
1366-
function::BuiltInFuncType{
1367-
OperatorId::Abs, function::DecimalFunctions::_Abs},
1368-
txn);
1350+
AddBuiltinFunction(
1351+
"abs", {type::TypeId::SMALLINT}, type::TypeId::SMALLINT,
1352+
internal_lang, "Abs",
1353+
function::BuiltInFuncType{OperatorId::Abs,
1354+
function::DecimalFunctions::_Abs},
1355+
txn);
13691356

1370-
AddBuiltinFunction("abs", {type::TypeId::INTEGER}, type::TypeId::INTEGER,
1371-
internal_lang, "Abs",
1372-
function::BuiltInFuncType{
1373-
OperatorId::Abs, function::DecimalFunctions::_Abs},
1374-
txn);
1357+
AddBuiltinFunction(
1358+
"abs", {type::TypeId::INTEGER}, type::TypeId::INTEGER,
1359+
internal_lang, "Abs",
1360+
function::BuiltInFuncType{OperatorId::Abs,
1361+
function::DecimalFunctions::_Abs},
1362+
txn);
13751363

1376-
AddBuiltinFunction("abs", {type::TypeId::BIGINT}, type::TypeId::BIGINT,
1377-
internal_lang, "Abs",
1378-
function::BuiltInFuncType{
1379-
OperatorId::Abs, function::DecimalFunctions::_Abs},
1380-
txn);
1364+
AddBuiltinFunction(
1365+
"abs", {type::TypeId::BIGINT}, type::TypeId::BIGINT,
1366+
internal_lang, "Abs",
1367+
function::BuiltInFuncType{OperatorId::Abs,
1368+
function::DecimalFunctions::_Abs},
1369+
txn);
13811370

13821371
AddBuiltinFunction(
13831372
"floor", {type::TypeId::INTEGER}, type::TypeId::DECIMAL,

src/catalog/table_catalog.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ bool TableCatalog::InsertTable(oid_t table_oid, const std::string &table_name,
412412
* @param txn TransactionContext
413413
* @return Whether deletion is successful
414414
*/
415-
bool TableCatalog::DeleteTable(oid_t table_oid,
416-
concurrency::TransactionContext *txn) {
415+
bool TableCatalog::DeleteTable(oid_t table_oid, concurrency::TransactionContext *txn) {
417416
oid_t index_offset = IndexId::PRIMARY_KEY; // Index of table_oid
418417
std::vector<type::Value> values;
419418
values.push_back(type::ValueFactory::GetIntegerValue(table_oid).Copy());

src/include/catalog/catalog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <mutex>
1616

1717
#include "catalog/catalog_defaults.h"
18-
#include "catalog/column_catalog.h"
1918
#include "function/functions.h"
2019

2120
namespace peloton {

src/include/catalog/schema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class Schema : public Printable {
196196
}
197197

198198
// Get the default value for the column
199-
inline type::Value *GetDefaultValue(const oid_t column_id) const {
199+
inline type::Value* GetDefaultValue(const oid_t column_id) const {
200200
for (auto constraint : columns[column_id].GetConstraints()) {
201201
if (constraint.GetType() == ConstraintType::DEFAULT) {
202202
return constraint.getDefaultValue();

src/include/catalog/table_catalog.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class TableCatalogObject {
4747
friend class ColumnCatalog;
4848

4949
public:
50-
TableCatalogObject(executor::LogicalTile *tile,
51-
concurrency::TransactionContext *txn, int tupleId = 0);
50+
TableCatalogObject(executor::LogicalTile *tile, concurrency::TransactionContext *txn,
51+
int tupleId = 0);
5252

5353
public:
5454
// Get indexes
@@ -73,9 +73,6 @@ class TableCatalogObject {
7373
std::shared_ptr<ColumnCatalogObject> GetColumnObject(
7474
const std::string &column_name, bool cached_only = false);
7575

76-
void ChangeColumnName(const std::vector<oid_t> &columns,
77-
const std::vector<std::string> &names);
78-
7976
inline oid_t GetTableOid() { return table_oid; }
8077
inline const std::string &GetTableName() { return table_name; }
8178
inline const std::string &GetSchemaName() { return schema_name; }

src/include/storage/database.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class Database : public Printable {
6969
std::string GetDBName();
7070
void setDBName(const std::string &database_name);
7171

72-
storage::DataTable *ReplaceTableWithOid(const oid_t table_oid,
73-
storage::DataTable *new_table);
74-
7572
protected:
7673
//===--------------------------------------------------------------------===//
7774
// MEMBERS

src/storage/database.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -176,25 +176,5 @@ void Database::setDBName(const std::string &database_name) {
176176
Database::database_name = database_name;
177177
}
178178

179-
storage::DataTable *Database::ReplaceTableWithOid(
180-
const oid_t table_oid, storage::DataTable *new_table) {
181-
{
182-
std::lock_guard<std::mutex> lock(database_mutex);
183-
184-
oid_t table_offset = 0;
185-
for (auto table : tables) {
186-
if (table->GetOid() == table_oid) {
187-
break;
188-
}
189-
table_offset++;
190-
}
191-
PL_ASSERT(table_offset < tables.size());
192-
193-
auto old_table = tables.at(table_offset);
194-
tables[table_offset] = new_table;
195-
return old_table;
196-
}
197-
}
198-
199179
} // namespace storage
200180
} // namespace peloton

0 commit comments

Comments
 (0)