Skip to content

Commit fe87554

Browse files
authored
fix(p3): fix insert, delete executor comments (#448)
Fix insert, delete executor comments
1 parent 746c07d commit fe87554

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/include/execution/executors/delete_executor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class DeleteExecutor : public AbstractExecutor {
4242
void Init() override;
4343

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

src/include/execution/executors/insert_executor.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ namespace bustub {
2424

2525
/**
2626
* InsertExecutor executes an insert on a table.
27-
*
28-
* Unlike UPDATE and DELETE, inserted values may either be
29-
* embedded in the plan itself or be pulled from a child executor.
27+
* Inserted values are always pulled from a child executor.
3028
*/
3129
class InsertExecutor : public AbstractExecutor {
3230
public:
3331
/**
3432
* Construct a new InsertExecutor instance.
3533
* @param exec_ctx The executor context
3634
* @param plan The insert plan to be executed
37-
* @param child_executor The child executor from which inserted tuples are pulled (may be `nullptr`)
35+
* @param child_executor The child executor from which inserted tuples are pulled
3836
*/
3937
InsertExecutor(ExecutorContext *exec_ctx, const InsertPlanNode *plan,
4038
std::unique_ptr<AbstractExecutor> &&child_executor);
@@ -43,13 +41,13 @@ class InsertExecutor : public AbstractExecutor {
4341
void Init() override;
4442

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

src/include/execution/plans/insert_plan.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ namespace bustub {
2525
/**
2626
* The InsertPlanNode identifies a table into which tuples are inserted.
2727
*
28-
* The values to be inserted are either embedded into the InsertPlanNode
29-
* itself, i.e. a "raw insert", or will come from the child of the node.
28+
* The values to be inserted will come from the child of the node.
3029
*
3130
* NOTE: To simplify the assignment, InsertPlanNode has at most one child.
3231
*/

0 commit comments

Comments
 (0)