Skip to content

Commit

Permalink
fix(p3): fix insert, delete executor comments (#448)
Browse files Browse the repository at this point in the history
Fix insert, delete executor comments
  • Loading branch information
yliang412 committed Oct 26, 2022
1 parent 746c07d commit fe87554
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/include/execution/executors/delete_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class DeleteExecutor : public AbstractExecutor {
void Init() override;

/**
* Yield the next tuple from the delete.
* @param[out] tuple The next tuple produced by the update
* @param[out] rid The next tuple RID produced by the update
* @return `false` unconditionally (throw to indicate failure)
* Yield the number of rows deleted from the table.
* @param[out] tuple The integer tuple indicating the number of rows deleted from the table
* @param[out] rid The next tuple RID produced by the update (ignore, not used)
* @return `true` if a tuple was produced, `false` if there are no more tuples
*
* NOTE: DeleteExecutor::Next() does not use the `tuple` out-parameter.
* NOTE: DeleteExecutor::Next() does not use the `rid` out-parameter.
* NOTE: DeleteExecutor::Next() returns true with the number of deleted rows produced only once
*/
auto Next([[maybe_unused]] Tuple *tuple, RID *rid) -> bool override;

Expand Down
14 changes: 6 additions & 8 deletions src/include/execution/executors/insert_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ namespace bustub {

/**
* InsertExecutor executes an insert on a table.
*
* Unlike UPDATE and DELETE, inserted values may either be
* embedded in the plan itself or be pulled from a child executor.
* Inserted values are always pulled from a child executor.
*/
class InsertExecutor : public AbstractExecutor {
public:
/**
* Construct a new InsertExecutor instance.
* @param exec_ctx The executor context
* @param plan The insert plan to be executed
* @param child_executor The child executor from which inserted tuples are pulled (may be `nullptr`)
* @param child_executor The child executor from which inserted tuples are pulled
*/
InsertExecutor(ExecutorContext *exec_ctx, const InsertPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor);
Expand All @@ -43,13 +41,13 @@ class InsertExecutor : public AbstractExecutor {
void Init() override;

/**
* Yield the next tuple from the insert.
* @param[out] tuple The next tuple produced by the insert
* @param[out] rid The next tuple RID produced by the insert
* Yield the number of rows inserted into the table.
* @param[out] tuple The integer tuple indicating the number of rows inserted into the table
* @param[out] rid The next tuple RID produced by the insert (ignore, not used)
* @return `true` if a tuple was produced, `false` if there are no more tuples
*
* NOTE: InsertExecutor::Next() does not use the `tuple` out-parameter.
* NOTE: InsertExecutor::Next() does not use the `rid` out-parameter.
* NOTE: InsertExecutor::Next() returns true with number of inserted rows produced only once
*/
auto Next([[maybe_unused]] Tuple *tuple, RID *rid) -> bool override;

Expand Down
3 changes: 1 addition & 2 deletions src/include/execution/plans/insert_plan.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ namespace bustub {
/**
* The InsertPlanNode identifies a table into which tuples are inserted.
*
* The values to be inserted are either embedded into the InsertPlanNode
* itself, i.e. a "raw insert", or will come from the child of the node.
* The values to be inserted will come from the child of the node.
*
* NOTE: To simplify the assignment, InsertPlanNode has at most one child.
*/
Expand Down

0 comments on commit fe87554

Please sign in to comment.