Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FilterProject to operator initialize framework #6480

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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