wutiangan commented on a change in pull request #3993:
URL: https://github.com/apache/incubator-doris/pull/3993#discussion_r448288786



##########
File path: be/src/olap/generic_iterators.cpp
##########
@@ -227,8 +229,13 @@ class MergeIterator : public RowwiseIterator {
         bool operator()(const MergeIteratorContext* lhs, const 
MergeIteratorContext* rhs) const {
             auto lhs_row = lhs->current_row();
             auto rhs_row = rhs->current_row();
-
-            return compare_row(lhs_row, rhs_row) > 0;
+            int cmp_res = compare_row(lhs_row, rhs_row);
+            if (cmp_res !=  0) {
+                return cmp_res > 0;
+            }
+            // if row cursors equal, compare segment id.

Review comment:
       add some comments why  sort by row asc, and sort by segment_id desc.




----------------------------------------------------------------
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.

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

Reply via email to