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

eldenmoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9bc7010639 fix topn be inoperative because Field == Null always return 
true (#23830)
9bc7010639 is described below

commit 9bc70106397858c56a2586d6d90b837ffc2dd480
Author: Kang <[email protected]>
AuthorDate: Mon Sep 4 16:02:07 2023 +0800

    fix topn be inoperative because Field == Null always return true (#23830)
    
    ```if (!new_top.is_null() && new_top != old_top)``` is always false since 
old_top is Null when init and Field == Null always return true.
    
    We add old_top.is_null() check first to avoid the problem and then issue 
more carefull discussion about Field == Null semantics.
---
 be/src/vec/exec/vsort_node.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/be/src/vec/exec/vsort_node.cpp b/be/src/vec/exec/vsort_node.cpp
index 45ef327dd3..f4eaafe634 100644
--- a/be/src/vec/exec/vsort_node.cpp
+++ b/be/src/vec/exec/vsort_node.cpp
@@ -144,7 +144,7 @@ Status VSortNode::sink(RuntimeState* state, 
vectorized::Block* input_block, bool
         // update runtime predicate
         if (_use_topn_opt) {
             Field new_top = _sorter->get_top_value();
-            if (!new_top.is_null() && new_top != old_top) {
+            if (!new_top.is_null() && (old_top.is_null() || new_top != 
old_top)) {
                 auto& sort_description = _sorter->get_sort_description();
                 auto col = 
input_block->get_by_position(sort_description[0].column_number);
                 bool is_reverse = sort_description[0].direction < 0;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to