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 2022/07/18 03:31:41 UTC

[GitHub] [doris] zhannngchen commented on a diff in pull request #9858: [Bug][Fix] One Rowset have same key output in unique table

zhannngchen commented on code in PR #9858:
URL: https://github.com/apache/doris/pull/9858#discussion_r922951190


##########
be/src/olap/tuple_reader.cpp:
##########
@@ -186,15 +186,24 @@ Status TupleReader::_unique_key_next_row(RowCursor* row_cursor, MemPool* mem_poo
         // in UNIQUE_KEY highest version is the final result, there is no need to
         // merge the lower versions
         direct_copy_row(row_cursor, *_next_key);
-        // skip the lower version rows;
-        auto res = _collect_iter.next(&_next_key, &_next_delete_flag);
-        if (LIKELY(res.precise_code() != OLAP_ERR_DATA_EOF)) {
-            if (UNLIKELY(!res.ok())) {
-                LOG(WARNING) << "next failed: " << res;
-                return res;
+        while (_next_key) {
+            // skip the lower version rows;
+            auto res = _collect_iter.next(&_next_key, &_next_delete_flag);
+            if (LIKELY(res.precise_code() != OLAP_ERR_DATA_EOF)) {
+                if (UNLIKELY(!res.ok())) {
+                    LOG(WARNING) << "next failed: " << res;
+                    return res;
+                }
+
+                if (!equal_row(_key_cids, *row_cursor, *_next_key)) {

Review Comment:
   @HappenLee Why do we need to merge keys here?
   1. If there are duplicate keys in one rowset, the MergeIterator will merge them.
   2. If there are duplicate keys between rowsets, the CollectIterator will merge them.



-- 
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-unsubscribe@doris.apache.org

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