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

Commit 6c986fd

Browse files
author
Dean Chen
committed
Fix auto-merge conflict
1 parent 470323a commit 6c986fd

File tree

4 files changed

+0
-117
lines changed

4 files changed

+0
-117
lines changed

src/catalog/abstract_catalog.cpp

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -178,73 +178,6 @@ bool AbstractCatalog::DeleteWithIndexScan(
178178
return status;
179179
}
180180

181-
/* @brief Update specific columns using index scan
182-
* @param update_columns Columns to be updated
183-
* @param update_values Values to be updated
184-
* @param scan_values Value to be scaned (used in index scan)
185-
* @param index_offset Offset of index for scan
186-
* @return true if successfully executes
187-
*/
188-
bool AbstractCatalog::UpdateWithIndexScan(
189-
std::vector<oid_t> update_columns, std::vector<type::Value> update_values,
190-
std::vector<type::Value> scan_values, oid_t index_offset,
191-
concurrency::TransactionContext *txn) {
192-
if (txn == nullptr) {
193-
throw CatalogException("Scan table requires transaction");
194-
}
195-
196-
std::unique_ptr<executor::ExecutorContext> context(
197-
new executor::ExecutorContext(txn));
198-
// Construct index scan executor
199-
auto index = catalog_table_->GetIndex(index_offset);
200-
oid_t index_oid = index->GetOid();
201-
std::vector<oid_t> key_column_offsets =
202-
index->GetMetadata()->GetKeySchema()->GetIndexedColumns();
203-
PELOTON_ASSERT(scan_values.size() == key_column_offsets.size());
204-
std::vector<ExpressionType> expr_types(scan_values.size(),
205-
ExpressionType::COMPARE_EQUAL);
206-
std::vector<expression::AbstractExpression *> runtime_keys;
207-
208-
planner::IndexScanPlan::IndexScanDesc index_scan_desc(
209-
index_oid, key_column_offsets, expr_types, scan_values, runtime_keys);
210-
211-
planner::IndexScanPlan index_scan_node(catalog_table_, nullptr,
212-
update_columns, index_scan_desc);
213-
214-
executor::IndexScanExecutor index_scan_executor(&index_scan_node,
215-
context.get());
216-
// Construct update executor
217-
TargetList target_list;
218-
DirectMapList direct_map_list;
219-
220-
size_t column_count = catalog_table_->GetSchema()->GetColumnCount();
221-
for (size_t col_itr = 0; col_itr < column_count; col_itr++) {
222-
// Skip any column for update
223-
if (std::find(std::begin(update_columns), std::end(update_columns),
224-
col_itr) == std::end(update_columns)) {
225-
direct_map_list.emplace_back(col_itr, std::make_pair(0, col_itr));
226-
}
227-
}
228-
229-
PELOTON_ASSERT(update_columns.size() == update_values.size());
230-
for (size_t i = 0; i < update_values.size(); i++) {
231-
planner::DerivedAttribute update_attribute{
232-
new expression::ConstantValueExpression(update_values[i])};
233-
target_list.emplace_back(update_columns[i], update_attribute);
234-
}
235-
236-
std::unique_ptr<const planner::ProjectInfo> project_info(
237-
new planner::ProjectInfo(std::move(target_list),
238-
std::move(direct_map_list)));
239-
planner::UpdatePlan update_node(catalog_table_, std::move(project_info));
240-
241-
executor::UpdateExecutor update_executor(&update_node, context.get());
242-
update_executor.AddChild(&index_scan_executor);
243-
// Execute
244-
update_executor.Init();
245-
return update_executor.Execute();
246-
}
247-
248181
/*@brief Index scan helper function
249182
* @param column_offsets Column ids for search (projection)
250183
* @param index_offset Offset of index for scan

src/catalog/catalog.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,40 +1116,6 @@ ResultType Catalog::AlterTable(oid_t database_oid, oid_t table_oid, const std::s
11161116
return ResultType::SUCCESS;
11171117
}
11181118

1119-
/**
1120-
* @brief Add new columns to the table.
1121-
* @param database_name database to which the table belongs to
1122-
* @param table_name table to which the column belongs to
1123-
* @param columns the column to be added
1124-
* @param txn the transaction Context
1125-
* @return TransactionContext ResultType(SUCCESS or FAILURE)
1126-
*
1127-
*/
1128-
ResultType Catalog::AddColumn(
1129-
UNUSED_ATTRIBUTE const std::string &database_name,
1130-
UNUSED_ATTRIBUTE const std::string &table_name,
1131-
UNUSED_ATTRIBUTE const std::vector<std::string> &columns,
1132-
UNUSED_ATTRIBUTE concurrency::TransactionContext *txn) {
1133-
// TODO: perform ADD Operation
1134-
return ResultType::SUCCESS;
1135-
}
1136-
1137-
/**
1138-
* @brief Drop the column from the table.
1139-
* @param database_name database to which the table belongs to
1140-
* @param table_name table to which the columns belong to
1141-
* @param columns the columns to be dropped
1142-
* @param txn the transaction Context
1143-
* @return TransactionContext ResultType(SUCCESS or FAILURE)
1144-
*/
1145-
1146-
ResultType Catalog::DropColumn(UNUSED_ATTRIBUTE const std::string &database_name,
1147-
UNUSED_ATTRIBUTE const std::string &table_name,
1148-
UNUSED_ATTRIBUTE const std::vector<std::string> &columns,
1149-
UNUSED_ATTRIBUTE concurrency::TransactionContext *txn) {
1150-
return ResultType::SUCCESS;
1151-
}
1152-
11531119
/**
11541120
* @brief Change the column name in the catalog.
11551121
* @param database_name database to which the table belongs to

src/include/catalog/abstract_catalog.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ class AbstractCatalog {
6262
bool DeleteWithIndexScan(oid_t index_offset, std::vector<type::Value> values,
6363
concurrency::TransactionContext *txn);
6464

65-
bool UpdateWithIndexScan(std::vector<oid_t> update_columns,
66-
std::vector<type::Value> update_values,
67-
std::vector<type::Value> scan_values,
68-
oid_t index_offset,
69-
concurrency::TransactionContext *txn);
70-
7165
std::unique_ptr<std::vector<std::unique_ptr<executor::LogicalTile>>>
7266
GetResultWithIndexScan(std::vector<oid_t> column_offsets, oid_t index_offset,
7367
std::vector<type::Value> values,

src/include/catalog/catalog.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,6 @@ class Catalog {
196196
std::unique_ptr<catalog::Schema> &new_schema,
197197
concurrency::TransactionContext *txn);
198198

199-
ResultType AddColumn(const std::string &database_name,
200-
const std::string &table_name,
201-
const std::vector<Column> &columns,
202-
concurrency::TransactionContext *txn);
203-
204-
ResultType DropColumn(const std::string &database_name,
205-
const std::string &table_name,
206-
const std::vector<Column> &columns,
207-
concurrency::TransactionContext *txn);
208-
209199
ResultType RenameColumn(const std::string &database_name,
210200
const std::string &table_name,
211201
const std::string &old_name,

0 commit comments

Comments
 (0)