github-actions[bot] commented on code in PR #31200:
URL: https://github.com/apache/doris/pull/31200#discussion_r1496901305
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -1975,7 +1975,30 @@ Status
SegmentIterator::_read_columns_by_rowids(std::vector<ColumnId>& read_colu
}
Status SegmentIterator::next_batch(vectorized::Block* block) {
- auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return
_next_batch_internal(block); }); }();
+ auto status = [&]() {
+ RETURN_IF_CATCH_EXCEPTION({
+ RETURN_IF_ERROR(_next_batch_internal(block));
+
+ // reverse block row order if read_orderby_key_reverse is true for
key topn
+ // it should be processed for all success _next_batch_internal
+ if (_opts.read_orderby_key_reverse) {
+ size_t num_rows = block->rows();
+ if (num_rows == 0) {
+ return Status::OK();
+ }
+ size_t num_columns = block->columns();
+ vectorized::IColumn::Permutation permutation;
+ for (size_t i = 0; i < num_rows; ++i)
permutation.emplace_back(num_rows - 1 - i);
Review Comment:
warning: statement should be inside braces
[readability-braces-around-statements]
```suggestion
for (size_t i = 0; i < num_rows; ++i) {
permutation.emplace_back(num_rows - 1 - i);
}
```
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -1975,7 +1975,30 @@
}
Status SegmentIterator::next_batch(vectorized::Block* block) {
- auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return
_next_batch_internal(block); }); }();
+ auto status = [&]() {
+ RETURN_IF_CATCH_EXCEPTION({
+ RETURN_IF_ERROR(_next_batch_internal(block));
+
+ // reverse block row order if read_orderby_key_reverse is true for
key topn
+ // it should be processed for all success _next_batch_internal
+ if (_opts.read_orderby_key_reverse) {
+ size_t num_rows = block->rows();
+ if (num_rows == 0) {
+ return Status::OK();
+ }
+ size_t num_columns = block->columns();
+ vectorized::IColumn::Permutation permutation;
+ for (size_t i = 0; i < num_rows; ++i)
permutation.emplace_back(num_rows - 1 - i);
+
+ for (size_t i = 0; i < num_columns; ++i)
Review Comment:
warning: statement should be inside braces
[readability-braces-around-statements]
```suggestion
for (size_t i = 0; i < num_columns; ++i) {
```
be/src/olap/rowset/segment_v2/segment_iterator.cpp:1994:
```diff
-
block->get_by_position(i).column->permute(permutation, num_rows);
+
block->get_by_position(i).column->permute(permutation, num_rows);
+ }
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]