@@ -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
0 commit comments