[fix](window_function) wrong order by range (#23346)

This commit is contained in:
Jerry Hu
2023-08-23 11:23:00 +08:00
committed by GitHub
parent ab9b29f11f
commit 14296ee87f
4 changed files with 25 additions and 2 deletions

View File

@ -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) {

View File

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

View File

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

View File

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