Skip to content

Commit

Permalink
Use Operator::finish() instead of setting isFinishing_ flag directly (#…
Browse files Browse the repository at this point in the history
…15)

Summary: Pull Request resolved: #15

Reviewed By: kgpai

Differential Revision: D30231266

Pulled By: mbasmanova

fbshipit-source-id: cb1d6d7b0923585753f19ddff458116036646f14
  • Loading branch information
mbasmanova authored and facebook-github-bot committed Aug 10, 2021
1 parent e7cb24e commit 7708357
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions velox/exec/OrderBy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ void OrderBy::addInput(RowVectorPtr input) {
}

void OrderBy::finish() {
Operator::finish();

// No data.
if (numRows_ == 0) {
isFinishing_ = true;
finished_ = true;
return;
}
Expand Down Expand Up @@ -87,8 +88,6 @@ void OrderBy::finish() {
}
return false; // lhs == rhs.
});

isFinishing_ = true;
}

RowVectorPtr OrderBy::getOutput() {
Expand Down
2 changes: 1 addition & 1 deletion velox/exec/TableScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TableScan : public SourceOperator {
}

void finish() override {
isFinishing_ = true;
Operator::finish();
close();
}

Expand Down
2 changes: 1 addition & 1 deletion velox/exec/TableWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TableWriter : public Operator {
void addInput(RowVectorPtr input) override;

void finish() override {
isFinishing_ = true;
Operator::finish();
close();
}

Expand Down
3 changes: 1 addition & 2 deletions velox/exec/TopN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ RowVectorPtr TopN::getOutput() {
}

void TopN::finish() {
Operator::finish();
if (topRows_.empty()) {
isFinishing_ = true;
finished_ = true;
return;
}
Expand All @@ -121,6 +121,5 @@ void TopN::finish() {
rows_[i - 1] = topRows_.top();
topRows_.pop();
}
isFinishing_ = true;
}
} // namespace facebook::velox::exec
2 changes: 1 addition & 1 deletion velox/exec/Values.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Values : public SourceOperator {
}

void finish() override {
isFinishing_ = true;
Operator::finish();
close();
}

Expand Down

0 comments on commit 7708357

Please sign in to comment.