From 79fa20fdc861ba9e930f9e121e9d76a09b630df0 Mon Sep 17 00:00:00 2001 From: Jialiang Tan Date: Fri, 15 Sep 2023 23:46:02 -0700 Subject: [PATCH] Add FilterProject to operator initialize framework (#6480) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/6480 Reviewed By: xiaoxmeng Differential Revision: D49074135 Pulled By: tanjialiang fbshipit-source-id: 8febeb041e9d5c7a50fa7bd4baec458229fed4f6 --- velox/exec/FilterProject.cpp | 11 ++--------- velox/exec/FilterProject.h | 2 +- velox/experimental/wave/exec/ToWave.cpp | 4 ---- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/velox/exec/FilterProject.cpp b/velox/exec/FilterProject.cpp index a4311b24f0cd..43d15d343f21 100644 --- a/velox/exec/FilterProject.cpp +++ b/velox/exec/FilterProject.cpp @@ -56,12 +56,8 @@ FilterProject::FilterProject( project_(project), filter_(filter) {} -void FilterProject::ensureInitialized() { - if (initialized_) { - VELOX_CHECK_NULL(filter_); - VELOX_CHECK_NULL(project_); - return; - } +void FilterProject::initialize() { + Operator::initialize(); std::vector allExprs; if (hasFilter_) { VELOX_CHECK_NOT_NULL(filter_); @@ -102,13 +98,11 @@ void FilterProject::ensureInitialized() { } } } - initialized_ = true; filter_.reset(); project_.reset(); } void FilterProject::addInput(RowVectorPtr input) { - ensureInitialized(); input_ = std::move(input); numProcessedInputRows_ = 0; if (!resultProjections_.empty()) { @@ -139,7 +133,6 @@ bool FilterProject::isFinished() { } RowVectorPtr FilterProject::getOutput() { - ensureInitialized(); if (allInputProcessed()) { return nullptr; } diff --git a/velox/exec/FilterProject.h b/velox/exec/FilterProject.h index 03e749a4bef6..e4eaf396af5f 100644 --- a/velox/exec/FilterProject.h +++ b/velox/exec/FilterProject.h @@ -71,7 +71,7 @@ class FilterProject : public Operator { return Export{exprs_.get(), hasFilter_, &resultProjections_}; } - void ensureInitialized(); + void initialize() override; private: // Tests if 'numProcessedRows_' equals to the length of input_ and clears diff --git a/velox/experimental/wave/exec/ToWave.cpp b/velox/experimental/wave/exec/ToWave.cpp index f9b9cae638e7..ddccfb3b5868 100644 --- a/velox/experimental/wave/exec/ToWave.cpp +++ b/velox/experimental/wave/exec/ToWave.cpp @@ -355,10 +355,6 @@ bool CompileState::compile() { // them during the transformation. driver_.initializeOperators(); for (; operatorIndex < operators.size(); ++operatorIndex) { - if (auto filterProject = dynamic_cast( - operators[operatorIndex])) { - filterProject->ensureInitialized(); - } if (!addOperator(operators[operatorIndex], nodeIndex, outputType)) { break; }