diff --git a/src/Processors/Transforms/PartialSortingTransform.cpp b/src/Processors/Transforms/PartialSortingTransform.cpp
index d461f968f2e..1cfd70546ae 100644
--- a/src/Processors/Transforms/PartialSortingTransform.cpp
+++ b/src/Processors/Transforms/PartialSortingTransform.cpp
@@ -65,7 +65,7 @@ size_t getFilterMask(const ColumnRawPtrs & lhs, const ColumnRawPtrs & rhs, size_
}
for (size_t i = 0; i != rows_num; ++i)
- filtered_count -= (filter[i] = (compare_results[i] >= 0));
+ filtered_count -= (filter[i] = (compare_results[i] <= 0));
return filtered_count;
}
diff --git a/tests/performance/string_sort.xml b/tests/performance/string_sort.xml
index 71b56bdb9d6..1d528f39428 100644
--- a/tests/performance/string_sort.xml
+++ b/tests/performance/string_sort.xml
@@ -32,6 +32,11 @@
+
+
+
+
+