You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/07/01 11:07:27 UTC

[GitHub] [incubator-doris] wutiangan commented on a change in pull request #3993: Keep order of read from segment consist with the write order

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org