diff --git a/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.cpp b/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.cpp index f11b5c0c646d5..a843ed65884d8 100644 --- a/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.cpp +++ b/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.cpp @@ -82,6 +82,15 @@ ShuffleExchangeSource::requestDataSizes(std::chrono::microseconds /*maxWait*/) { return folly::makeSemiFuture(Response{0, atEnd_, std::move(remainingBytes)}); } +bool ShuffleExchangeSource::supportsMetrics() const { + return shuffleReader_->supportsMetrics(); +} + +folly::F14FastMap +ShuffleExchangeSource::metrics() const { + return shuffleReader_->metrics(); +} + folly::F14FastMap ShuffleExchangeSource::stats() const { return shuffleReader_->stats(); } diff --git a/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.h b/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.h index a44d03f396128..5365331faa3b5 100644 --- a/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.h +++ b/presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.h @@ -68,6 +68,10 @@ class ShuffleExchangeSource : public velox::exec::ExchangeSource { folly::F14FastMap stats() const override; + bool supportsMetrics() const override; + + folly::F14FastMap metrics() const override; + /// url needs to follow below format: /// batch://?shuffleInfo= static std::shared_ptr createExchangeSource( diff --git a/presto-native-execution/presto_cpp/main/operators/ShuffleInterface.h b/presto-native-execution/presto_cpp/main/operators/ShuffleInterface.h index a499ae8bd1a48..4b8cb1fce584a 100644 --- a/presto-native-execution/presto_cpp/main/operators/ShuffleInterface.h +++ b/presto-native-execution/presto_cpp/main/operators/ShuffleInterface.h @@ -57,6 +57,16 @@ class ShuffleReader { /// Runtime statistics. virtual folly::F14FastMap stats() const = 0; + + /// Returns true if the shuffle reader supports Velox runtime metrics. + virtual bool supportsMetrics() const { + return false; + } + + /// Returns statistics in the form of Velox runtime metrics. + virtual folly::F14FastMap metrics() const { + VELOX_NYI(); + } }; class ShuffleInterfaceFactory {