Skip to content

Commit

Permalink
[VL] Fix usage of uninitialized variables
Browse files Browse the repository at this point in the history
Use of Uninitialized Variables
  • Loading branch information
jkhaliqi committed Jan 10, 2025
1 parent 4bdda17 commit 4750239
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions cpp/velox/compute/WholeStageResultIterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ std::shared_ptr<velox::core::QueryCtx> WholeStageResultIterator::createNewVeloxQ

std::shared_ptr<ColumnarBatch> WholeStageResultIterator::next() {
tryAddSplitsToTask();
GLUTEN_CHECK(task_ != nullptr, "task_ is nullptr");
if (task_->isFinished()) {
return nullptr;
}
Expand Down
8 changes: 5 additions & 3 deletions cpp/velox/memory/VeloxMemoryManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class ListenableArbitrator : public velox::memory::MemoryArbitrator {
uint64_t shrinkCapacity(uint64_t targetBytes, bool allowSpill, bool allowAbort) override {
velox::memory::ScopedMemoryArbitrationContext ctx{};
facebook::velox::exec::MemoryReclaimer::Stats status;
velox::memory::MemoryPool* pool;
velox::memory::MemoryPool* pool = nullptr;
{
std::unique_lock guard{mutex_};
VELOX_CHECK_EQ(candidates_.size(), 1, "ListenableArbitrator should only be used within a single root pool");
Expand Down Expand Up @@ -178,7 +178,7 @@ class ListenableArbitrator : public velox::memory::MemoryArbitrator {
return freeBytes;
}

gluten::AllocationListener* listener_;
gluten::AllocationListener* listener_ = nullptr;
const uint64_t memoryPoolInitialCapacity_; // FIXME: Unused.
const uint64_t memoryPoolTransferCapacity_;
const uint64_t memoryReclaimMaxWaitMs_;
Expand Down Expand Up @@ -216,6 +216,7 @@ class ArbitratorFactoryRegister {

VeloxMemoryManager::VeloxMemoryManager(const std::string& kind, std::unique_ptr<AllocationListener> listener)
: MemoryManager(kind), listener_(std::move(listener)) {
GLUTEN_CHECK(listener_ != nullptr, "VeloxMemoryManager failed");
auto reservationBlockSize = VeloxBackend::get()->getBackendConf()->get<uint64_t>(
kMemoryReservationBlockSize, kMemoryReservationBlockSizeDefault);
auto memInitCapacity =
Expand Down Expand Up @@ -278,7 +279,8 @@ int64_t shrinkVeloxMemoryPool(velox::memory::MemoryManager* mm, velox::memory::M
VLOG(2) << logPrefix << "Pool has reserved " << pool->usedBytes() << "/" << pool->root()->reservedBytes() << "/"
<< pool->root()->capacity() << "/" << pool->root()->maxCapacity() << " bytes.";
VLOG(2) << logPrefix << "Shrinking...";
auto shrunken = mm->arbitrator()->shrinkCapacity(pool, 0);
auto shrunken = 0;
shrunken = mm->arbitrator()->shrinkCapacity(pool, 0);
VLOG(2) << logPrefix << shrunken << " bytes released from shrinking.";
return shrunken;
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/velox/substrait/SubstraitToVeloxPlan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ core::PlanNodePtr SubstraitToVeloxPlanConverter::constructValueStreamNode(
}

auto outputType = ROW(std::move(outNames), std::move(veloxTypeList));
std::shared_ptr<ResultIterator> iterator;
std::shared_ptr<ResultIterator> iterator = nullptr;
if (!validationMode_) {
VELOX_CHECK_LT(streamIdx, inputIters_.size(), "Could not find stream index {} in input iterator list.", streamIdx);
iterator = inputIters_[streamIdx];
Expand Down Expand Up @@ -1254,7 +1254,7 @@ core::PlanNodePtr SubstraitToVeloxPlanConverter::toVeloxPlan(const ::substrait::

// Velox requires Filter Pushdown must being enabled.
bool filterPushdownEnabled = true;
std::shared_ptr<connector::hive::HiveTableHandle> tableHandle;
std::shared_ptr<connector::hive::HiveTableHandle> tableHandle = nullptr;
if (!readRel.has_filter()) {
tableHandle = std::make_shared<connector::hive::HiveTableHandle>(
kHiveConnectorId, "hive_table", filterPushdownEnabled, connector::hive::SubfieldFilters{}, nullptr);
Expand Down

0 comments on commit 4750239

Please sign in to comment.