Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiayi771 committed Oct 19, 2023
1 parent 8ced8d9 commit 00470bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 3 additions & 2 deletions velox/common/memory/tests/SharedArbitratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ class SharedArbitrationTest : public exec::test::HiveConnectorTestBase {
}

RowVectorPtr newVector() {
VectorFuzzer fuzzer(fuzzerOpts_, pool());
auto seed = folly::Random::rand32();
VectorFuzzer fuzzer(fuzzerOpts_, pool(), seed);
return fuzzer.fuzzRow(rowType_);
}

Expand Down Expand Up @@ -1291,7 +1292,7 @@ DEBUG_ONLY_TEST_F(SharedArbitrationTest, reclaimFromJoinBuilder) {
std::atomic_bool taskPauseDone{false};
folly::EventCount taskPauseWait;

const auto joinMemoryUsage = 32L << 20;
const auto joinMemoryUsage = 2L << 20;
const auto fakeAllocationSize = kMemoryCapacity - joinMemoryUsage / 2;

std::atomic<bool> injectAllocationOnce{true};
Expand Down
20 changes: 8 additions & 12 deletions velox/exec/HashBuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void HashBuild::addInput(RowVectorPtr input) {
TestValue::adjust("facebook::velox::exec::HashBuild::addInput", this);

// Prevents the memory arbitrator to reclaim memory from this operator during
// the execution belowg.
// the execution below.
NonReclaimableSection guard(this);

activeRows_.resize(input->size());
Expand Down Expand Up @@ -848,16 +848,10 @@ bool HashBuild::finishHashBuild() {
// https://github.com/facebookincubator/velox/issues/3567 is fixed.
const bool allowParallelJoinBuild =
!otherTables.empty() && spillPartitions.empty();
// For left semi and anti join, in case when HashBuild operator runs
// single-threaded there is no need to build hash table again after
// processing all input.
const bool needPrepareJoinTable = !(dropDuplicates_ && otherTables.empty());
if (needPrepareJoinTable) {
table_->prepareJoinTable(
std::move(otherTables),
allowParallelJoinBuild ? operatorCtx_->task()->queryCtx()->executor()
: nullptr);
}
table_->prepareJoinTable(
std::move(otherTables),
allowParallelJoinBuild ? operatorCtx_->task()->queryCtx()->executor()
: nullptr);
addRuntimeStats();
if (joinBridge_->setHashTable(
std::move(table_), std::move(spillPartitions), joinHasNullKeys_)) {
Expand Down Expand Up @@ -1168,7 +1162,9 @@ void HashBuild::reclaim(
// TODO: support fine-grain disk spilling based on 'targetBytes' after
// having row container memory compaction support later.
buildOp->spiller_->spill();
VELOX_CHECK_EQ(buildOp->table_->numDistinct(), 0);
if (!dropDuplicates_) {
VELOX_CHECK_EQ(buildOp->table_->numDistinct(), 0);
}
buildOp->table_->clear();
// Release the minimum reserved memory.
op->pool()->release();
Expand Down

0 comments on commit 00470bd

Please sign in to comment.