diff --git a/presto-native-execution/presto_cpp/main/operators/ShuffleWrite.cpp b/presto-native-execution/presto_cpp/main/operators/ShuffleWrite.cpp index 988231eda5711..6a50ac3edc1a2 100644 --- a/presto-native-execution/presto_cpp/main/operators/ShuffleWrite.cpp +++ b/presto-native-execution/presto_cpp/main/operators/ShuffleWrite.cpp @@ -120,16 +120,16 @@ class ShuffleWrite : public Operator { void recordShuffleWriteClientStats() { auto lockedStats = stats_.wlock(); - std::optional backgroundCpuTimeMsOpt = std::nullopt; + std::optional backgroundCpuTimeNanosOpt = std::nullopt; if (shuffle_->supportsMetrics()) { const auto shuffleMetrics = shuffle_->metrics(); for (const auto& [name, metric] : shuffleMetrics) { lockedStats->runtimeStats[name] = metric; } - if (shuffleMetrics.contains(ExchangeClient::kBackgroundCpuTimeMs)) { - backgroundCpuTimeMsOpt = - shuffleMetrics.at(ExchangeClient::kBackgroundCpuTimeMs).sum; + if (shuffleMetrics.contains(Operator::kBackgroundCpuTimeNanos)) { + backgroundCpuTimeNanosOpt = + shuffleMetrics.at(Operator::kBackgroundCpuTimeNanos).sum; } } else { const auto shuffleStats = shuffle_->stats(); @@ -137,18 +137,17 @@ class ShuffleWrite : public Operator { lockedStats->runtimeStats[name] = RuntimeMetric(value); } - if (shuffleStats.contains(ExchangeClient::kBackgroundCpuTimeMs)) { - backgroundCpuTimeMsOpt = - shuffleStats.at(ExchangeClient::kBackgroundCpuTimeMs); + if (shuffleStats.contains(Operator::kBackgroundCpuTimeNanos)) { + backgroundCpuTimeNanosOpt = + shuffleStats.at(Operator::kBackgroundCpuTimeNanos); } } - if (backgroundCpuTimeMsOpt.has_value()) { + if (backgroundCpuTimeNanosOpt.has_value()) { const CpuWallTiming backgroundTiming{ - static_cast(1), - 0, - static_cast(*backgroundCpuTimeMsOpt) * - Timestamp::kNanosecondsInMillisecond}; + .count = static_cast(1), + .wallNanos = 0, + .cpuNanos = static_cast(*backgroundCpuTimeNanosOpt)}; lockedStats->backgroundTiming.clear(); lockedStats->backgroundTiming.add(backgroundTiming); } diff --git a/presto-native-execution/presto_cpp/main/operators/tests/ShuffleTest.cpp b/presto-native-execution/presto_cpp/main/operators/tests/ShuffleTest.cpp index 086cb47029a20..02fa24e6deb41 100644 --- a/presto-native-execution/presto_cpp/main/operators/tests/ShuffleTest.cpp +++ b/presto-native-execution/presto_cpp/main/operators/tests/ShuffleTest.cpp @@ -42,7 +42,7 @@ namespace facebook::presto::operators::test { namespace { -static const uint64_t kFakeBackgroundCpuTimeMs = 123; +static const uint64_t kFakeBackgroundCpuTimeNanos = 123000000; struct TestShuffleInfo { uint32_t numPartitions; @@ -153,7 +153,7 @@ class TestShuffleWriter : public ShuffleWriter { folly::F14FastMap stats() const override { return { {"test-shuffle.write", 1002}, - {exec::ExchangeClient::kBackgroundCpuTimeMs, kFakeBackgroundCpuTimeMs}}; + {exec::Operator::kBackgroundCpuTimeNanos, kFakeBackgroundCpuTimeNanos}}; } std::shared_ptr>>>& @@ -248,7 +248,7 @@ class TestShuffleReader : public ShuffleReader { folly::F14FastMap stats() const override { return { {"test-shuffle.read", 1032}, - {exec::ExchangeClient::kBackgroundCpuTimeMs, kFakeBackgroundCpuTimeMs}}; + {exec::Operator::kBackgroundCpuTimeNanos, kFakeBackgroundCpuTimeNanos}}; } private: @@ -1033,7 +1033,7 @@ TEST_F(ShuffleTest, endToEnd) { numPartitions, numMapDrivers, {data}, - kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond); + kFakeBackgroundCpuTimeNanos); } TEST_F(ShuffleTest, endToEndWithSortedShuffle) { @@ -1074,7 +1074,7 @@ TEST_F(ShuffleTest, endToEndWithSortedShuffle) { numPartitions, numMapDrivers, {batch1, batch2}, - kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond, + kFakeBackgroundCpuTimeNanos, ordering, fields, expectedSortingOrder); @@ -1131,7 +1131,7 @@ TEST_F(ShuffleTest, endToEndWithSortedShuffleRowLimit) { numPartitions, numMapDrivers, {data}, - kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond, + kFakeBackgroundCpuTimeNanos, ordering, fields, expectedSortingOrder, @@ -1160,7 +1160,7 @@ TEST_F(ShuffleTest, endToEndWithReplicateNullAndAny) { numPartitions, numMapDrivers, {data}, - kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond); + kFakeBackgroundCpuTimeNanos); } TEST_F(ShuffleTest, replicateNullsAndAny) { diff --git a/presto-native-execution/velox b/presto-native-execution/velox index e11eb4bc93c69..267ad70c8008d 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit e11eb4bc93c692645083d2b7a1f13b6499fe2546 +Subproject commit 267ad70c8008da08262abb1d55850de4b3d9eb4e