diff --git a/src/Interpreters/Aggregator.cpp b/src/Interpreters/Aggregator.cpp index f740dff7c422..00b9088184d9 100644 --- a/src/Interpreters/Aggregator.cpp +++ b/src/Interpreters/Aggregator.cpp @@ -806,6 +806,11 @@ AggregatedDataVariants::Type Aggregator::chooseAggregationMethod() return AggregatedDataVariants::Type::low_cardinality_key32; if (size_of_field == 8) return AggregatedDataVariants::Type::low_cardinality_key64; + if (size_of_field == 16) + return AggregatedDataVariants::Type::low_cardinality_keys128; + if (size_of_field == 32) + return AggregatedDataVariants::Type::low_cardinality_keys256; + throw Exception("Logical error: low cardinality numeric column has sizeOfField not in 1, 2, 4, 8, 16, 32.", ErrorCodes::LOGICAL_ERROR); } if (size_of_field == 1) diff --git a/tests/queries/0_stateless/02459_low_cardinality_uint128_aggregator.reference b/tests/queries/0_stateless/02459_low_cardinality_uint128_aggregator.reference new file mode 100644 index 000000000000..2a3af430e485 --- /dev/null +++ b/tests/queries/0_stateless/02459_low_cardinality_uint128_aggregator.reference @@ -0,0 +1,20 @@ +0 4950 +1 14950 +2 24950 +3 34950 +4 44950 +5 54950 +6 64950 +7 74950 +8 84950 +9 94950 +0 4950 +1 14950 +2 24950 +3 34950 +4 44950 +5 54950 +6 64950 +7 74950 +8 84950 +9 94950 diff --git a/tests/queries/0_stateless/02459_low_cardinality_uint128_aggregator.sql b/tests/queries/0_stateless/02459_low_cardinality_uint128_aggregator.sql new file mode 100644 index 000000000000..893e5514ba52 --- /dev/null +++ b/tests/queries/0_stateless/02459_low_cardinality_uint128_aggregator.sql @@ -0,0 +1,9 @@ +SET allow_suspicious_low_cardinality_types = 1; +-- LC UInt128 +CREATE TABLE group_by_pk_lc_uint128 (`k` LowCardinality(UInt128), `v` UInt32) ENGINE = MergeTree ORDER BY k PARTITION BY v%50; +INSERT INTO group_by_pk_lc_uint128 SELECT number / 100, number FROM numbers(1000); +SELECT k, sum(v) AS s FROM group_by_pk_lc_uint128 GROUP BY k ORDER BY k ASC LIMIT 1024 SETTINGS optimize_aggregation_in_order = 1; +-- LC UInt256 +CREATE TABLE group_by_pk_lc_uint256 (`k` LowCardinality(UInt256), `v` UInt32) ENGINE = MergeTree ORDER BY k PARTITION BY v%50; +INSERT INTO group_by_pk_lc_uint256 SELECT number / 100, number FROM numbers(1000); +SELECT k, sum(v) AS s FROM group_by_pk_lc_uint256 GROUP BY k ORDER BY k ASC LIMIT 1024 SETTINGS optimize_aggregation_in_order = 1;