GoGoWen commented on a change in pull request #6965: URL: https://github.com/apache/incubator-doris/pull/6965#discussion_r739820481
########## File path: be/src/olap/reader.cpp ########## @@ -130,10 +130,16 @@ OLAPStatus Reader::init(const ReaderParams& read_params) { << ", version:" << read_params.version; return res; } - + // optimize for single rowset reading without do aggregation when reading all columns, + // and otherwise should use _agg_key_next_row for AGG_KEYS if (_optimize_for_single_rowset(rs_readers)) { - _next_row_func = _tablet->keys_type() == AGG_KEYS ? &Reader::_direct_agg_key_next_row - : &Reader::_direct_next_row; + if(_tablet->keys_type() == AGG_KEYS && _return_columns.size() == _tablet->tablet_schema().num_columns()) { + _next_row_func = &Reader::_direct_agg_key_next_row; + } else if (_tablet->keys_type() == AGG_KEYS) { + _next_row_func = &Reader::_agg_key_next_row; Review comment: For example, the table test (k int ,k1 int ,k2 int ,k3 int, v int sum), if we read all columns (k,k1,k2,k3,v), then it definitely no need to call agg. However, if we just need (k,k1,v), then if we do not call agg, there are many many duplicate-key rows for next caller(may be aggregation node), it's not a good idea to pass these rows without aggregation to aggregation node for a query. -- 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