Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,35 +120,34 @@ class ShuffleWrite : public Operator {

void recordShuffleWriteClientStats() {
auto lockedStats = stats_.wlock();
std::optional<uint64_t> backgroundCpuTimeMsOpt = std::nullopt;
std::optional<uint64_t> backgroundCpuTimeNanosOpt = std::nullopt;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/backgroundCpuTimeNanosOpt/backgroundCpuTimeNsOpt/

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();
for (const auto& [name, value] : shuffleStats) {
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<uint64_t>(1),
0,
static_cast<uint64_t>(*backgroundCpuTimeMsOpt) *
Timestamp::kNanosecondsInMillisecond};
.count = static_cast<uint64_t>(1),
.wallNanos = 0,
.cpuNanos = static_cast<uint64_t>(*backgroundCpuTimeNanosOpt)};
lockedStats->backgroundTiming.clear();
lockedStats->backgroundTiming.add(backgroundTiming);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -153,7 +153,7 @@ class TestShuffleWriter : public ShuffleWriter {
folly::F14FastMap<std::string, int64_t> stats() const override {
return {
{"test-shuffle.write", 1002},
{exec::ExchangeClient::kBackgroundCpuTimeMs, kFakeBackgroundCpuTimeMs}};
{exec::Operator::kBackgroundCpuTimeNanos, kFakeBackgroundCpuTimeNanos}};
}

std::shared_ptr<std::vector<std::vector<std::unique_ptr<ReadBatch>>>>&
Expand Down Expand Up @@ -248,7 +248,7 @@ class TestShuffleReader : public ShuffleReader {
folly::F14FastMap<std::string, int64_t> stats() const override {
return {
{"test-shuffle.read", 1032},
{exec::ExchangeClient::kBackgroundCpuTimeMs, kFakeBackgroundCpuTimeMs}};
{exec::Operator::kBackgroundCpuTimeNanos, kFakeBackgroundCpuTimeNanos}};
}

private:
Expand Down Expand Up @@ -1033,7 +1033,7 @@ TEST_F(ShuffleTest, endToEnd) {
numPartitions,
numMapDrivers,
{data},
kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond);
kFakeBackgroundCpuTimeNanos);
}

TEST_F(ShuffleTest, endToEndWithSortedShuffle) {
Expand Down Expand Up @@ -1074,7 +1074,7 @@ TEST_F(ShuffleTest, endToEndWithSortedShuffle) {
numPartitions,
numMapDrivers,
{batch1, batch2},
kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond,
kFakeBackgroundCpuTimeNanos,
ordering,
fields,
expectedSortingOrder);
Expand Down Expand Up @@ -1131,7 +1131,7 @@ TEST_F(ShuffleTest, endToEndWithSortedShuffleRowLimit) {
numPartitions,
numMapDrivers,
{data},
kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond,
kFakeBackgroundCpuTimeNanos,
ordering,
fields,
expectedSortingOrder,
Expand Down Expand Up @@ -1160,7 +1160,7 @@ TEST_F(ShuffleTest, endToEndWithReplicateNullAndAny) {
numPartitions,
numMapDrivers,
{data},
kFakeBackgroundCpuTimeMs * Timestamp::kNanosecondsInMillisecond);
kFakeBackgroundCpuTimeNanos);
}

TEST_F(ShuffleTest, replicateNullsAndAny) {
Expand Down
2 changes: 1 addition & 1 deletion presto-native-execution/velox
Submodule velox updated 49 files
+19 −10 velox/benchmarks/QueryBenchmarkBase.cpp
+5 −2 velox/benchmarks/QueryBenchmarkBase.h
+87 −100 velox/benchmarks/tpch/TpchBenchmark.cpp
+27 −0 velox/benchmarks/tpch/TpchBenchmark.h
+1 −0 velox/benchmarks/tpch/TpchBenchmarkMain.cpp
+5 −4 velox/docs/functions/spark/aggregate.rst
+1 −1 velox/docs/functions/spark/datetime.rst
+32 −1 velox/docs/functions/spark/decimal.rst
+18 −1 velox/docs/functions/spark/math.rst
+7 −3 velox/dwio/common/ParallelUnitLoader.cpp
+5 −6 velox/exec/Exchange.cpp
+2 −2 velox/exec/ExchangeClient.h
+1 −1 velox/exec/ExchangeSource.h
+5 −0 velox/exec/Operator.h
+1 −1 velox/exec/tests/MultiFragmentTest.cpp
+2 −2 velox/exec/tests/utils/LocalExchangeSource.cpp
+4 −0 velox/experimental/cudf/CMakeLists.txt
+22 −0 velox/experimental/cudf/benchmarks/CMakeLists.txt
+161 −0 velox/experimental/cudf/benchmarks/CudfTpchBenchmark.cpp
+39 −0 velox/experimental/cudf/benchmarks/CudfTpchBenchmark.h
+77 −0 velox/experimental/cudf/benchmarks/benchmark.sh
+5 −1 velox/experimental/cudf/connectors/hive/CMakeLists.txt
+38 −0 velox/experimental/cudf/exec/CudfOperator.h
+9 −4 velox/experimental/cudf/exec/ToCudf.cpp
+1 −0 velox/expression/fuzzer/ExpressionFuzzerTest.cpp
+3 −11 velox/functions/lib/DateTimeUtil.h
+10 −4 velox/functions/lib/RegistrationHelpers.h
+1 −0 velox/functions/prestosql/CMakeLists.txt
+79 −0 velox/functions/prestosql/InRewrite.cpp
+31 −0 velox/functions/prestosql/InRewrite.h
+3 −0 velox/functions/prestosql/registration/GeneralFunctionsRegistration.cpp
+1 −0 velox/functions/prestosql/tests/CMakeLists.txt
+118 −0 velox/functions/prestosql/tests/InRewriteTest.cpp
+40 −0 velox/functions/sparksql/Arithmetic.h
+4 −2 velox/functions/sparksql/DateTimeFunctions.h
+130 −24 velox/functions/sparksql/DecimalArithmetic.cpp
+2 −0 velox/functions/sparksql/DecimalArithmetic.h
+27 −0 velox/functions/sparksql/DecimalUtil.h
+66 −25 velox/functions/sparksql/aggregates/AverageAggregate.cpp
+246 −0 velox/functions/sparksql/aggregates/DecimalAverageAggregate.h
+250 −3 velox/functions/sparksql/aggregates/tests/AverageAggregationTest.cpp
+6 −0 velox/functions/sparksql/registration/RegisterDatetime.cpp
+5 −0 velox/functions/sparksql/registration/RegisterMath.cpp
+59 −5 velox/functions/sparksql/tests/ArithmeticTest.cpp
+18 −0 velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp
+118 −0 velox/functions/sparksql/tests/DecimalArithmeticTest.cpp
+28 −0 velox/functions/sparksql/tests/DecimalUtilTest.cpp
+1 −1 velox/type/tests/ConversionsTest.cpp
+1 −1 velox/vector/FlatVector-inl.h
Loading