Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit a9153ea

Browse files
dasdipanjan04apavlo
authored andcommitted
DropIndex By Index Name Implementation #1090
Formatting Changes in catalog.cpp and catalog.h Fix drop_test.cpp by applying EXPECT_EQ into proper transactions and removing EXPECT_EQ where it wasn't required. @poojanilangekar did the changes. I don't understand why the formatting changes keep on happening. Solves #285
1 parent ba59937 commit a9153ea

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/catalog/catalog.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ ResultType Catalog::CreateIndex(const std::string &database_name,
377377

378378
LOG_TRACE("Trying to create index %s for table %s", index_name.c_str(),
379379
table_name.c_str());
380+
380381
// check if database exists
381382
auto database_object =
382383
DatabaseCatalog::GetInstance()->GetDatabaseObject(database_name, txn);
@@ -392,9 +393,11 @@ ResultType Catalog::CreateIndex(const std::string &database_name,
392393

393394
IndexConstraintType index_constraint =
394395
unique_keys ? IndexConstraintType::UNIQUE : IndexConstraintType::DEFAULT;
396+
395397
ResultType success = CreateIndex(
396398
database_object->GetDatabaseOid(), table_object->GetTableOid(), key_attrs,
397399
index_name, index_type, index_constraint, unique_keys, txn);
400+
398401
return success;
399402
}
400403

src/include/catalog/catalog.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ class Catalog {
176176
std::shared_ptr<TableCatalogObject> GetTableObject(
177177
oid_t database_oid, oid_t table_oid,
178178
concurrency::TransactionContext *txn);
179-
180-
181179
//===--------------------------------------------------------------------===//
182180
// DEPRECATED FUNCTIONS
183181
//===--------------------------------------------------------------------===//

test/executor/drop_test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,8 @@ TEST_F(DropTests, DroppingIndexByName) {
260260
txn_manager.CommitTransaction(txn);
261261

262262
txn = txn_manager.BeginTransaction();
263-
auto index_catalog = catalog::IndexCatalog::GetInstance()->GetIndexObject(
264-
index_name1, txn);
265263
// Check the effect of drop
266264
// Most major check in this test case
267-
EXPECT_EQ(catalog::IndexCatalog::GetInstance()->GetIndexObject(
268-
index_name1, txn), index_catalog);
269-
270265
// Now dropping the index using the DropIndex functionality
271266
catalog->DropIndex(index_name1,txn);
272267
EXPECT_EQ(catalog::IndexCatalog::GetInstance()->GetIndexObject(
@@ -275,6 +270,11 @@ TEST_F(DropTests, DroppingIndexByName) {
275270

276271
// Drop the table just created
277272
txn = txn_manager.BeginTransaction();
273+
// Check the effect of drop index
274+
EXPECT_EQ(catalog::IndexCatalog::GetInstance()->GetIndexObject(
275+
index_name1, txn), nullptr);
276+
277+
// Now dropping the table
278278
catalog->DropTable(TEST_DB_NAME, "department_table_01", txn);
279279
txn_manager.CommitTransaction(txn);
280280

0 commit comments

Comments
 (0)