spaces-X commented on code in PR #10084: URL: https://github.com/apache/doris/pull/10084#discussion_r911079204
########## be/src/vec/olap/block_reader.cpp: ########## @@ -154,6 +177,49 @@ Status BlockReader::init(const ReaderParams& read_params) { return Status::OK(); } +Status BlockReader::next_block_with_aggregation(Block* block, MemPool* mem_pool, + ObjectPool* agg_pool, bool* eof) { + return _block_aggregator ? _agg_next_block(block, mem_pool, agg_pool, eof) + : (this->*_next_block_func)(block, mem_pool, agg_pool, eof); +} + +Status BlockReader::_agg_next_block(Block* block, MemPool* mem_pool, ObjectPool* agg_pool, + bool* eof) { + Status status; + while (true) { + if (_block_aggregator->source_exhausted()) { + status = (this->*_next_block_func)(block, mem_pool, agg_pool, eof); + if (UNLIKELY(!status.ok())) { + return status; + } + if (UNLIKELY(status.precise_code() == OLAP_ERR_DATA_EOF || block->rows() == 0)) { + break; + } + + _block_aggregator->update_source(block); Review Comment: nit: is it necessary to sort the block when the `group by` column is not at the very beginning in table schema? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org