Skip to content

Commit af1594b

Browse files
xiaoxmengfacebook-github-bot
authored andcommitted
[sv-cosco]perf: Support fetch multiple blocks based on max bytes
Differential Revision: D85830101
1 parent 6a51bc1 commit af1594b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

presto-native-execution/presto_cpp/main/operators/ShuffleExchangeSource.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ namespace facebook::presto::operators {
3131

3232
folly::SemiFuture<ShuffleExchangeSource::Response>
3333
ShuffleExchangeSource::request(
34-
uint32_t /*maxBytes*/,
34+
uint32_t maxBytes,
3535
std::chrono::microseconds /*maxWait*/) {
36-
auto nextBatch = [this]() {
37-
return std::move(shuffleReader_->next(1))
38-
.deferValue([this](std::vector<std::unique_ptr<ReadBatch>>&& batches) {
36+
auto nextBatch = [this, maxBytes]() {
37+
return std::move(shuffleReader_->next(maxBytes))
38+
.deferValue([this, maxBytes](std::vector<std::unique_ptr<ReadBatch>>&& batches) {
39+
LOG(ERROR) << "batch size: " << batches.size() << " maxBytes: " << velox::succinctBytes(maxBytes);
3940
std::vector<velox::ContinuePromise> promises;
4041
int64_t totalBytes{0};
4142
{

presto-native-execution/presto_cpp/main/operators/ShuffleInterface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ class ShuffleReader {
5656
public:
5757
virtual ~ShuffleReader() = default;
5858

59+
/// Fetch the next batch of rows from the shuffle reader.
60+
/// @param bytes Maximum number of bytes to read in this batch.
61+
/// @return A semi-future resolving to a vector of ReadBatch pointers, where
62+
/// each ReadBatch contains rows and associated data buffers.
5963
virtual folly::SemiFuture<std::vector<std::unique_ptr<ReadBatch>>> next(
60-
size_t numBatches) = 0;
64+
uint64_t maxBytes) = 0;
6165

6266
/// Tell the shuffle system the reader is done. May be called with 'success'
6367
/// true before reading all the data. This happens when a query has a LIMIT or

0 commit comments

Comments
 (0)