diff --git a/be/src/vec/exec/vanalytic_eval_node.cpp b/be/src/vec/exec/vanalytic_eval_node.cpp index 09c64e752d..c31e65b8c1 100644 --- a/be/src/vec/exec/vanalytic_eval_node.cpp +++ b/be/src/vec/exec/vanalytic_eval_node.cpp @@ -487,7 +487,7 @@ BlockRowPos VAnalyticEvalNode::_compare_row_to_find_end(int idx, BlockRowPos sta } //binary search, set start and end pos int64_t start_pos = start_init_row_num; - int64_t end_pos = _input_blocks[start.block_num].rows() - 1; + int64_t end_pos = _input_blocks[start.block_num].rows(); //if end_block_num haven't moved, only start_block_num go to the end block //so could use the end.row_num for binary search if (start.block_num == end.block_num) { diff --git a/regression-test/data/nereids_syntax_p0/window_function.out b/regression-test/data/nereids_syntax_p0/window_function.out index a3a30becb9..5e91a4682d 100644 --- a/regression-test/data/nereids_syntax_p0/window_function.out +++ b/regression-test/data/nereids_syntax_p0/window_function.out @@ -274,6 +274,22 @@ 7 3 4 7 3 4 +-- !range -- +1 8 +1 8 +1 8 +1 8 +1 8 +1 8 +1 8 +1 8 +2 20 +2 20 +2 20 +2 20 +2 20 +2 20 + -- !cte -- 1 8 1 8 diff --git a/regression-test/pipeline/p0/conf/regression-conf.groovy b/regression-test/pipeline/p0/conf/regression-conf.groovy index 0a63242d98..c5847ecede 100644 --- a/regression-test/pipeline/p0/conf/regression-conf.groovy +++ b/regression-test/pipeline/p0/conf/regression-conf.groovy @@ -54,7 +54,7 @@ testDirectories = "" // this groups will not be executed excludeGroups = "" // this suites will not be executed -excludeSuites = "nereids_scalar_fn_Array,test_pk_uk_index_change,test_pk_uk_case,test_default_limit,window_function,test_profile,test_broker_load,test_spark_load,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,test_transactional_hive,nereids_delete_mow_partial_update" +excludeSuites = "nereids_scalar_fn_Array,test_pk_uk_index_change,test_pk_uk_case,test_default_limit,test_profile,test_broker_load,test_spark_load,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,test_transactional_hive,nereids_delete_mow_partial_update" // this directories will not be executed excludeDirectories = "workload_manager_p1" diff --git a/regression-test/suites/nereids_syntax_p0/window_function.groovy b/regression-test/suites/nereids_syntax_p0/window_function.groovy index 332bd070e3..538038c774 100644 --- a/regression-test/suites/nereids_syntax_p0/window_function.groovy +++ b/regression-test/suites/nereids_syntax_p0/window_function.groovy @@ -135,6 +135,13 @@ suite("window_function") { ) sub """ + sql """ set batch_size = 3; """ + sql """ set parallel_pipeline_task_num = 8; """ + + order_qt_range """ + SELECT c1, (sum(c1) over (ORDER BY c1 range between UNBOUNDED preceding and CURRENT ROW)) FROM window_test; + """ + order_qt_cte """ WITH cte as (select c1 as x from window_test) SELECT x, (sum(x) over (ORDER BY x range between UNBOUNDED preceding and CURRENT ROW)) FROM cte;