From 3f4a09478dc363ae2112256692660a48a96f813a Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Thu, 23 Jun 2022 23:01:11 +0300 Subject: [PATCH] Revert "Fix optimization in PartialSortingTransform (SIGSEGV and possible incorrect result)" --- src/Processors/Transforms/PartialSortingTransform.cpp | 2 +- ...02345_partial_sort_transform_optimization.reference | 10 ---------- .../02345_partial_sort_transform_optimization.sql | 3 --- 3 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 tests/queries/0_stateless/02345_partial_sort_transform_optimization.reference delete mode 100644 tests/queries/0_stateless/02345_partial_sort_transform_optimization.sql diff --git a/src/Processors/Transforms/PartialSortingTransform.cpp b/src/Processors/Transforms/PartialSortingTransform.cpp index b0f866cb3fd..131bf4f8e7c 100644 --- a/src/Processors/Transforms/PartialSortingTransform.cpp +++ b/src/Processors/Transforms/PartialSortingTransform.cpp @@ -71,7 +71,7 @@ bool compareWithThreshold(const ColumnRawPtrs & raw_block_columns, size_t min_bl size_t raw_block_columns_size = raw_block_columns.size(); for (size_t i = 0; i < raw_block_columns_size; ++i) { - int res = sort_description[i].direction * raw_block_columns[i]->compareAt(min_block_index, 0, *threshold_columns[i], sort_description[i].nulls_direction); + int res = sort_description[i].direction * raw_block_columns[i]->compareAt(min_block_index, 0, *threshold_columns[0], sort_description[i].nulls_direction); if (res < 0) return true; diff --git a/tests/queries/0_stateless/02345_partial_sort_transform_optimization.reference b/tests/queries/0_stateless/02345_partial_sort_transform_optimization.reference deleted file mode 100644 index e6c99ff9291..00000000000 --- a/tests/queries/0_stateless/02345_partial_sort_transform_optimization.reference +++ /dev/null @@ -1,10 +0,0 @@ -0 999999 999999 -0 999998 999998 -0 999997 999997 -0 999996 999996 -0 999995 999995 -0 999994 999994 -0 999993 999993 -0 999992 999992 -0 999991 999991 -0 999990 999990 diff --git a/tests/queries/0_stateless/02345_partial_sort_transform_optimization.sql b/tests/queries/0_stateless/02345_partial_sort_transform_optimization.sql deleted file mode 100644 index e7855c47474..00000000000 --- a/tests/queries/0_stateless/02345_partial_sort_transform_optimization.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Regression for PartialSortingTransform optimization --- that requires at least 1500 rows. -select * from (select * from (select 0 a, toNullable(number) b, toString(number) c from numbers(1e6)) order by a desc, b desc, c limit 1500) limit 10;