diff --git a/src/Processors/Transforms/CubeTransform.cpp b/src/Processors/Transforms/CubeTransform.cpp index afbb996f56e..5e88c102165 100644 --- a/src/Processors/Transforms/CubeTransform.cpp +++ b/src/Processors/Transforms/CubeTransform.cpp @@ -7,7 +7,7 @@ namespace DB { namespace ErrorCodes { - extern const int LOGICAL_ERROR; + extern const int TOO_MANY_COLUMNS; } CubeTransform::CubeTransform(Block header, AggregatingTransformParamsPtr params_, bool use_nulls_) @@ -15,7 +15,7 @@ CubeTransform::CubeTransform(Block header, AggregatingTransformParamsPtr params_ , aggregates_mask(getAggregatesMask(params->getHeader(), params->params.aggregates)) { if (keys.size() >= 8 * sizeof(mask)) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Too many keys are used for CubeTransform."); + throw Exception(ErrorCodes::TOO_MANY_COLUMNS, "Too many keys ({}) are used for CubeTransform, the maximum is {}.", keys.size(), 8 * sizeof(mask) - 1); } Chunk CubeTransform::generate() diff --git a/tests/queries/0_stateless/03253_group_by_cube_too_many_keys.reference b/tests/queries/0_stateless/03253_group_by_cube_too_many_keys.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/03253_group_by_cube_too_many_keys.sql b/tests/queries/0_stateless/03253_group_by_cube_too_many_keys.sql new file mode 100644 index 00000000000..616387d39ae --- /dev/null +++ b/tests/queries/0_stateless/03253_group_by_cube_too_many_keys.sql @@ -0,0 +1,2 @@ +SELECT * FROM (SELECT '' AS c0, '' AS c1, '' AS c2, '' AS c3, '' AS c4, '' AS c5, '' AS c6, '' AS c7, '' AS c8, '' AS c9, '' AS c10, '' AS c11, '' AS c12, '' AS c13, '' AS c14, '' AS c15, '' AS c16, '' AS c17, '' AS c18, '' AS c19, '' AS c20, '' AS c21, '' AS c22, '' AS c23, '' AS c24, '' AS c25, '' AS c26, '' AS c27, '' AS c28, '' AS c29, '' AS c30, '' AS c31, '' AS c32, '' AS c33, '' AS c34, '' AS c35, '' AS c36, '' AS c37, '' AS c38, '' AS c39, '' AS c40, '' AS c41, '' AS c42, '' AS c43, '' AS c44, '' AS c45, '' AS c46, '' AS c47, '' AS c48, '' AS c49, '' AS c50, '' AS c51, '' AS c52, '' AS c53, '' AS c54, '' AS c55, '' AS c56, '' AS c57, '' AS c58, '' AS c59, '' AS c60, '' AS c61, '' AS c62, '' AS c63, '' AS c64) +GROUP BY ALL WITH CUBE; -- { serverError TOO_MANY_COLUMNS }