Skip to content

Commit 578c927

Browse files
fix(p3): remove init check plan (#546)
1 parent 64a5e72 commit 578c927

File tree

4 files changed

+10
-59
lines changed

4 files changed

+10
-59
lines changed

src/execution/executor_factory.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "execution/executors/update_executor.h"
3636
#include "execution/executors/values_executor.h"
3737
#include "execution/plans/filter_plan.h"
38-
#include "execution/plans/init_check_plan.h"
3938
#include "execution/plans/mock_scan_plan.h"
4039
#include "execution/plans/projection_plan.h"
4140
#include "execution/plans/sort_plan.h"
@@ -100,11 +99,10 @@ auto ExecutorFactory::CreateExecutor(ExecutorContext *exec_ctx, const AbstractPl
10099
auto left = ExecutorFactory::CreateExecutor(exec_ctx, nested_loop_join_plan->GetLeftPlan());
101100
auto right = ExecutorFactory::CreateExecutor(exec_ctx, nested_loop_join_plan->GetRightPlan());
102101
if (check_options_set.find(CheckOption::ENABLE_NLJ_CHECK) != check_options_set.end()) {
103-
auto left_init_check_plan = dynamic_cast<const InitCheckPlanNode *>(nested_loop_join_plan->GetLeftPlan().get());
104-
auto right_init_check_plan =
105-
dynamic_cast<const InitCheckPlanNode *>(nested_loop_join_plan->GetRightPlan().get());
106-
auto left_check = std::make_unique<InitCheckExecutor>(exec_ctx, left_init_check_plan, std::move(left));
107-
auto right_check = std::make_unique<InitCheckExecutor>(exec_ctx, right_init_check_plan, std::move(right));
102+
auto left_check =
103+
std::make_unique<InitCheckExecutor>(exec_ctx, nested_loop_join_plan->GetLeftPlan(), std::move(left));
104+
auto right_check =
105+
std::make_unique<InitCheckExecutor>(exec_ctx, nested_loop_join_plan->GetRightPlan(), std::move(right));
108106
exec_ctx->AddCheckExecutor(left_check.get(), right_check.get());
109107
return std::make_unique<NestedLoopJoinExecutor>(exec_ctx, nested_loop_join_plan, std::move(left_check),
110108
std::move(right_check));

src/execution/init_check_executor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "execution/executors/init_check_executor.h"
14+
#include "execution/plans/abstract_plan.h"
1415

1516
namespace bustub {
1617

17-
InitCheckExecutor::InitCheckExecutor(ExecutorContext *exec_ctx, const InitCheckPlanNode *plan,
18+
InitCheckExecutor::InitCheckExecutor(ExecutorContext *exec_ctx, const AbstractPlanNodeRef &plan,
1819
std::unique_ptr<AbstractExecutor> &&child_executor)
19-
: AbstractExecutor{exec_ctx}, child_executor_{std::move(child_executor)} {}
20+
: AbstractExecutor{exec_ctx}, plan_{plan}, child_executor_{std::move(child_executor)} {}
2021

2122
void InitCheckExecutor::Init() {
2223
if (!child_executor_) {

src/include/execution/executors/init_check_executor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include "execution/executor_context.h"
1919
#include "execution/executors/abstract_executor.h"
20-
#include "execution/plans/init_check_plan.h"
20+
#include "execution/plans/abstract_plan.h"
2121

2222
namespace bustub {
2323

@@ -32,7 +32,7 @@ class InitCheckExecutor : public AbstractExecutor {
3232
* @param plan The init check plan to be executed
3333
* @param child_executor The child executor from which init calls are counted
3434
*/
35-
InitCheckExecutor(ExecutorContext *exec_ctx, const InitCheckPlanNode *plan,
35+
InitCheckExecutor(ExecutorContext *exec_ctx, const AbstractPlanNodeRef &plan,
3636
std::unique_ptr<AbstractExecutor> &&child_executor);
3737

3838
/** Initialize the InitCheck */
@@ -63,7 +63,7 @@ class InitCheckExecutor : public AbstractExecutor {
6363
constexpr static const bool EXECUTOR_EXHAUSTED{false};
6464

6565
/** The init check plan node to be executed */
66-
const InitCheckPlanNode *plan_;
66+
const AbstractPlanNodeRef &plan_;
6767

6868
/** The child executor from which tuples are obtained */
6969
std::unique_ptr<AbstractExecutor> child_executor_;

src/include/execution/plans/init_check_plan.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)