Analyzer: Fix LOGICAL_ERROR in CountDistinctPass

This commit is contained in:
Dmitry Novik 2024-01-11 19:11:42 +00:00
parent 90a64ae5b8
commit f41c6b0e6b
3 changed files with 11 additions and 0 deletions

View File

@ -61,6 +61,8 @@ public:
return;
auto & count_distinct_argument_column = count_distinct_arguments_nodes[0];
if (count_distinct_argument_column->getNodeType() != QueryTreeNodeType::COLUMN)
return;
auto & count_distinct_argument_column_typed = count_distinct_argument_column->as<ColumnNode &>();
/// Build subquery SELECT count_distinct_argument_column FROM table_expression GROUP BY count_distinct_argument_column

View File

@ -0,0 +1,8 @@
set count_distinct_optimization = 1;
SELECT uniqExact('257')
FROM
(SELECT
number, CAST(number / 9223372036854775806, 'UInt64') AS m
FROM numbers(3)
);