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

yiguolei 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 861f31205a [fix](window function) invalid order_by_start in 
VAnalyticEvalNode (#16589)
861f31205a is described below

commit 861f31205a86b40f1a43cd2c195917eaeb202969
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Fri Feb 10 17:40:40 2023 +0800

    [fix](window function) invalid order_by_start in VAnalyticEvalNode (#16589)
---
 be/src/vec/exec/vanalytic_eval_node.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/exec/vanalytic_eval_node.cpp 
b/be/src/vec/exec/vanalytic_eval_node.cpp
index e52d835a76..f31fc03daf 100644
--- a/be/src/vec/exec/vanalytic_eval_node.cpp
+++ b/be/src/vec/exec/vanalytic_eval_node.cpp
@@ -468,7 +468,7 @@ BlockRowPos VAnalyticEvalNode::_compare_row_to_find_end(int 
idx, BlockRowPos sta
 
     //check whether need get column again, maybe same as first init
     // if the start_block_num have move to forword, so need update start block 
num and compare it from row_num=0
-    if (start_column.get() != start_next_block_column.get()) {
+    if (start_block_num != start.block_num) {
         start_init_row_num = 0;
         start.block_num = start_block_num;
         start_column = 
_input_blocks[start.block_num].get_by_position(idx).column;
@@ -477,7 +477,7 @@ BlockRowPos VAnalyticEvalNode::_compare_row_to_find_end(int 
idx, BlockRowPos sta
     int64_t start_pos = start_init_row_num;
     int64_t end_pos = _input_blocks[start.block_num].rows() - 1;
     //if end_block_num haven't moved, only start_block_num go to the end block
-    //so could used the end.row_num for binary search
+    //so could use the end.row_num for binary search
     if (start.block_num == end.block_num) {
         end_pos = end.row_num;
     }
@@ -489,7 +489,7 @@ BlockRowPos VAnalyticEvalNode::_compare_row_to_find_end(int 
idx, BlockRowPos sta
             start_pos = mid_pos + 1;
         }
     }
-    start.row_num = start_pos; //upadte row num, return the find end
+    start.row_num = start_pos; //update row num, return the find end
     return start;
 }
 
@@ -684,6 +684,12 @@ void VAnalyticEvalNode::_update_order_by_range() {
             input_block_first_row_positions[_order_by_start.block_num] + 
_order_by_start.row_num;
     _order_by_end.pos =
             input_block_first_row_positions[_order_by_end.block_num] + 
_order_by_end.row_num;
+    // `_order_by_end` will be assigned to `_order_by_start` next time,
+    // so make it a valid position.
+    if (_order_by_end.row_num == 
_input_blocks[_order_by_end.block_num].rows()) {
+        _order_by_end.block_num++;
+        _order_by_end.row_num = 0;
+    }
 }
 
 Status VAnalyticEvalNode::_init_result_columns() {


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

Reply via email to