Skip to content

Commit

Permalink
Add FilterProject to operator initialize framework (facebookincubator…
Browse files Browse the repository at this point in the history
…#6480)

Summary: Pull Request resolved: facebookincubator#6480

Reviewed By: xiaoxmeng

Differential Revision: D49074135

Pulled By: tanjialiang

fbshipit-source-id: 8febeb041e9d5c7a50fa7bd4baec458229fed4f6
  • Loading branch information
tanjialiang authored and codyschierbeck committed Sep 27, 2023
1 parent 09ed962 commit 593844b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
11 changes: 2 additions & 9 deletions velox/exec/FilterProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<core::TypedExprPtr> allExprs;
if (hasFilter_) {
VELOX_CHECK_NOT_NULL(filter_);
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -139,7 +133,6 @@ bool FilterProject::isFinished() {
}

RowVectorPtr FilterProject::getOutput() {
ensureInitialized();
if (allInputProcessed()) {
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion velox/exec/FilterProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions velox/experimental/wave/exec/ToWave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,6 @@ bool CompileState::compile() {
// them during the transformation.
driver_.initializeOperators();
for (; operatorIndex < operators.size(); ++operatorIndex) {
if (auto filterProject = dynamic_cast<velox::exec::FilterProject*>(
operators[operatorIndex])) {
filterProject->ensureInitialized();
}
if (!addOperator(operators[operatorIndex], nodeIndex, outputType)) {
break;
}
Expand Down

0 comments on commit 593844b

Please sign in to comment.