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/10/08 03:00:26 UTC

[GitHub] [doris] luozenglin commented on a diff in pull request #13125: [fix](sort) fix nullable column sorting incorrectly

luozenglin commented on code in PR #13125:
URL: https://github.com/apache/doris/pull/13125#discussion_r990578722


##########
be/src/vec/core/sort_block.h:
##########
@@ -259,15 +261,25 @@ class ColumnSorter {
                         flags[not_null_range.first] = 0;
                     }
                     if (is_null_range.first < is_null_range.second) {
+                        // do not sort null values
                         std::fill(flags.begin() + is_null_range.first,
-                                  flags.begin() + is_null_range.second, 1);
+                                  flags.begin() + is_null_range.second, 0);
 
-                        flags[is_null_range.first] = 0;
+                        if (_limit > is_null_range.first && _limit <= is_null_range.second) {
+                            _limit = is_null_range.second;

Review Comment:
   Why can this statement be removed? I think an `UNLIKELY` could be added.



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