You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/14 05:58:59 UTC

[doris] 03/12: [fix](aggregate) agg table and unique table get different result when… (#14822)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 569e6ed57e395637e530e9b4d5318dbd7cfb4c96
Author: xueweizhang <zx...@163.com>
AuthorDate: Thu Dec 8 22:54:36 2022 +0800

    [fix](aggregate) agg table and unique table get different result when… (#14822)
    
    Signed-off-by: nextdreamblue <zx...@163.com>
---
 be/src/olap/generic_iterators.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/be/src/olap/generic_iterators.cpp b/be/src/olap/generic_iterators.cpp
index afb752ab04..f8be5dc02b 100644
--- a/be/src/olap/generic_iterators.cpp
+++ b/be/src/olap/generic_iterators.cpp
@@ -263,15 +263,18 @@ private:
             }
 
             // if row cursors equal, compare segment id.
-            // here we sort segment id in reverse order, because of the row order in AGG_KEYS
-            // dose no matter, but in UNIQUE_KEYS table we only read the latest is one, so we
-            // return the row in reverse order of segment id
-            bool result = res == 0 ? lhs->data_id() < rhs->data_id() : res < 0;
+            // when in UNIQUE_KEYS table, we need only read the latest one, so we
+            // return the row in reverse order of segment id.
+            // when in AGG_KEYS table, we return the row in order of segment id, because
+            // we need replace the value with lower segment id by the one with higher segment id when
+            // non-vectorized.
             if (_is_unique) {
+                bool result = res == 0 ? lhs->data_id() < rhs->data_id() : res < 0;
                 result ? lhs->set_skip(true) : rhs->set_skip(true);
+                return result;
             }
 
-            return result;
+            return lhs->data_id() > rhs->data_id();
         }
 
         int _sequence_id_idx;


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