Skip to content

Commit

Permalink
fix: Make TopNRowNumber reclaimable when loading lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjialiang committed Dec 5, 2024
1 parent 37a5ffb commit 859cf1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions velox/exec/Operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ class Operator : public BaseRuntimeStatWriter {
/// should be called after this.
virtual void close();

// Returns true if 'this' never has more output rows than input rows.
/// Returns true if 'this' never has more output rows than input rows.
virtual bool isFilter() const {
return false;
}
Expand Down Expand Up @@ -832,7 +832,7 @@ std::vector<column_index_t> calculateOutputChannels(
const RowTypePtr& targetInputType,
const RowTypePtr& targetOutputType);

// A first operator in a Driver, e.g. table scan or exchange client.
/// A first operator in a Driver, e.g. table scan or exchange client.
class SourceOperator : public Operator {
public:
SourceOperator(
Expand Down
10 changes: 8 additions & 2 deletions velox/exec/TopNRowNumber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,14 @@ void TopNRowNumber::addInput(RowVectorPtr input) {

const auto numInput = input->size();

for (auto i = 0; i < inputChannels_.size(); ++i) {
decodedVectors_[i].decode(*input->childAt(inputChannels_[i]));
{
// Potential large memory usage site that might trigger arbitration. Make it
// reclaimable because at this point it does not break the operator's state
// atomicity.
ReclaimableSectionGuard guard(this);
for (auto i = 0; i < inputChannels_.size(); ++i) {
decodedVectors_[i].decode(*input->childAt(inputChannels_[i]));
}
}

if (table_) {
Expand Down

0 comments on commit 859cf1a

Please sign in to comment.