From 545528917fd7700be0f6c582be970dbd23feeab5 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Fri, 26 Feb 2021 13:17:00 +0300 Subject: [PATCH] Fix tests. --- src/Common/ColumnsHashing.h | 10 +++++++- src/Interpreters/AggregationCommon.h | 1 + src/Interpreters/Aggregator.h | 35 +++++++++++++++++----------- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/Common/ColumnsHashing.h b/src/Common/ColumnsHashing.h index 7bc84eb3429..37cb42a8bda 100644 --- a/src/Common/ColumnsHashing.h +++ b/src/Common/ColumnsHashing.h @@ -508,7 +508,15 @@ struct HashMethodKeysFixed } if constexpr (!has_low_cardinality && !has_nullable_keys && sizeof(Key) <= 16) - packFixedBatch(keys_size, Base::getActualColumns(), key_sizes, prepared_keys); + { + bool has_unsupported_sizes = false; + for (auto size : key_sizes) + if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) + has_unsupported_sizes = true; + + if (!has_unsupported_sizes) + packFixedBatch(keys_size, Base::getActualColumns(), key_sizes, prepared_keys); + } #if defined(__SSSE3__) && !defined(MEMORY_SANITIZER) if constexpr (!has_low_cardinality && !has_nullable_keys && sizeof(Key) <= 16) diff --git a/src/Interpreters/AggregationCommon.h b/src/Interpreters/AggregationCommon.h index 8bdea536392..0e9661eaef1 100644 --- a/src/Interpreters/AggregationCommon.h +++ b/src/Interpreters/AggregationCommon.h @@ -104,6 +104,7 @@ template void packFixedBatch(size_t keys_size, const ColumnRawPtrs & key_columns, const Sizes & key_sizes, PaddedPODArray & out) { size_t offset = 0; + fillFixedBatch(keys_size, key_columns, key_sizes, out, offset); fillFixedBatch(keys_size, key_columns, key_sizes, out, offset); fillFixedBatch(keys_size, key_columns, key_sizes, out, offset); fillFixedBatch(keys_size, key_columns, key_sizes, out, offset); diff --git a/src/Interpreters/Aggregator.h b/src/Interpreters/Aggregator.h index abeb80171f4..f08b9302082 100644 --- a/src/Interpreters/Aggregator.h +++ b/src/Interpreters/Aggregator.h @@ -389,25 +389,34 @@ struct AggregationMethodKeysFixed if constexpr (!has_low_cardinality && !has_nullable_keys && sizeof(Key) <= 16) { - Sizes new_sizes; - auto fill_size = [&](size_t size) + bool has_unsupported_sizes = false; + for (auto size : key_sizes) + if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) + has_unsupported_sizes = true; + + if (!has_unsupported_sizes) { - for (size_t i = 0; i < key_sizes.size(); ++i) + Sizes new_sizes; + auto fill_size = [&](size_t size) { - if (key_sizes[i] == size) + for (size_t i = 0; i < key_sizes.size(); ++i) { - new_columns.push_back(key_columns[i].get()); - new_sizes.push_back(size); + if (key_sizes[i] == size) + { + new_columns.push_back(key_columns[i].get()); + new_sizes.push_back(size); + } } - } - }; + }; - fill_size(8); - fill_size(4); - fill_size(2); - fill_size(1); + fill_size(16); + fill_size(8); + fill_size(4); + fill_size(2); + fill_size(1); - return {new_columns, new_sizes}; + return {new_columns, new_sizes}; + } } for (auto & column : key_columns)