Skip to content

Commit

Permalink
fix: only report storage stats if not empty
Browse files Browse the repository at this point in the history
Differential Revision: D66932271
  • Loading branch information
xiaoxmeng authored and facebook-github-bot committed Dec 9, 2024
1 parent 929affe commit a8912f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
30 changes: 20 additions & 10 deletions velox/connectors/hive/HiveDataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,16 +468,6 @@ std::unordered_map<std::string, RuntimeCounter> HiveDataSource::runtimeStats() {
{"prefetchBytes",
RuntimeCounter(
ioStats_->prefetch().sum(), RuntimeCounter::Unit::kBytes)},
{"numStorageRead", RuntimeCounter(ioStats_->read().count())},
{"storageReadBytes",
RuntimeCounter(ioStats_->read().sum(), RuntimeCounter::Unit::kBytes)},
{"numLocalRead", RuntimeCounter(ioStats_->ssdRead().count())},
{"localReadBytes",
RuntimeCounter(
ioStats_->ssdRead().sum(), RuntimeCounter::Unit::kBytes)},
{"numRamRead", RuntimeCounter(ioStats_->ramHit().count())},
{"ramReadBytes",
RuntimeCounter(ioStats_->ramHit().sum(), RuntimeCounter::Unit::kBytes)},
{"totalScanTime",
RuntimeCounter(
ioStats_->totalScanTime(), RuntimeCounter::Unit::kNanos)},
Expand All @@ -496,6 +486,26 @@ std::unordered_map<std::string, RuntimeCounter> HiveDataSource::runtimeStats() {
{"overreadBytes",
RuntimeCounter(
ioStats_->rawOverreadBytes(), RuntimeCounter::Unit::kBytes)}});
if (ioStats_->read().count() > 0) {
res.insert({"numStorageRead", RuntimeCounter(ioStats_->read().count())});
res.insert(
{"storageReadBytes",
RuntimeCounter(ioStats_->read().sum(), RuntimeCounter::Unit::kBytes)});
}
if (ioStats_->ssdRead().count() > 0) {
res.insert({"numLocalRead", RuntimeCounter(ioStats_->ssdRead().count())});
res.insert(
{"localReadBytes",
RuntimeCounter(
ioStats_->ssdRead().sum(), RuntimeCounter::Unit::kBytes)});
}
if (ioStats_->ramHit().count() > 0) {
res.insert({"numRamRead", RuntimeCounter(ioStats_->ramHit().count())});
res.insert(
{"ramReadBytes",
RuntimeCounter(
ioStats_->ramHit().sum(), RuntimeCounter::Unit::kBytes)});
}
if (numBucketConversion_ > 0) {
res.insert({"numBucketConversion", RuntimeCounter(numBucketConversion_)});
}
Expand Down
6 changes: 0 additions & 6 deletions velox/exec/tests/PrintPlanWithStatsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ TEST_F(PrintPlanWithStatsTest, innerJoinWithTableScan) {
{" dynamicFiltersAccepted[ ]* sum: 1, count: 1, min: 1, max: 1"},
{" flattenStringDictionaryValues [ ]* sum: 0, count: 1, min: 0, max: 0"},
{" ioWaitWallNanos [ ]* sum: .+, count: .+ min: .+, max: .+"},
{" localReadBytes [ ]* sum: 0B, count: 1, min: 0B, max: 0B"},
{" maxSingleIoWaitWallNanos[ ]*sum: .+, count: 1, min: .+, max: .+"},
{" numLocalRead [ ]* sum: 0, count: 1, min: 0, max: 0"},
{" numPrefetch [ ]* sum: .+, count: 1, min: .+, max: .+"},
{" numRamRead [ ]* sum: 60, count: 1, min: 60, max: 60"},
{" numStorageRead [ ]* sum: .+, count: 1, min: .+, max: .+"},
Expand Down Expand Up @@ -287,9 +285,7 @@ TEST_F(PrintPlanWithStatsTest, partialAggregateWithTableScan) {
{" dataSourceReadWallNanos[ ]* sum: .+, count: 1, min: .+, max: .+"},
{" flattenStringDictionaryValues [ ]* sum: 0, count: 1, min: 0, max: 0"},
{" ioWaitWallNanos [ ]* sum: .+, count: .+ min: .+, max: .+"},
{" localReadBytes [ ]* sum: 0B, count: 1, min: 0B, max: 0B"},
{" maxSingleIoWaitWallNanos[ ]*sum: .+, count: 1, min: .+, max: .+"},
{" numLocalRead [ ]* sum: 0, count: 1, min: 0, max: 0"},
{" numPrefetch [ ]* sum: .+, count: .+, min: .+, max: .+"},
{" numRamRead [ ]* sum: 7, count: 1, min: 7, max: 7"},
{" numStorageRead [ ]* sum: .+, count: 1, min: .+, max: .+"},
Expand Down Expand Up @@ -361,9 +357,7 @@ TEST_F(PrintPlanWithStatsTest, tableWriterWithTableScan) {
{" dataSourceReadWallNanos[ ]* sum: .+, count: 1, min: .+, max: .+"},
{" flattenStringDictionaryValues [ ]* sum: 0, count: 1, min: 0, max: 0"},
{" ioWaitWallNanos [ ]* sum: .+, count: .+ min: .+, max: .+"},
{" localReadBytes [ ]* sum: 0B, count: 1, min: 0B, max: 0B"},
{" maxSingleIoWaitWallNanos[ ]*sum: .+, count: 1, min: .+, max: .+"},
{" numLocalRead [ ]* sum: 0, count: 1, min: 0, max: 0"},
{" numPrefetch [ ]* sum: .+, count: .+, min: .+, max: .+"},
{" numRamRead [ ]* sum: 7, count: 1, min: 7, max: 7"},
{" numStorageRead [ ]* sum: .+, count: 1, min: .+, max: .+"},
Expand Down

0 comments on commit a8912f6

Please sign in to comment.