mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #39444 from amosbird/fix-trivial-count-opt-1
Fix trivial count optimization with array join
This commit is contained in:
commit
82fc7375dd
@ -1016,7 +1016,7 @@ void TreeRewriterResult::collectUsedColumns(const ASTPtr & query, bool is_select
|
||||
has_explicit_columns = !required.empty();
|
||||
if (is_select && !has_explicit_columns)
|
||||
{
|
||||
optimize_trivial_count = true;
|
||||
optimize_trivial_count = !columns_context.has_array_join;
|
||||
|
||||
/// You need to read at least one column to find the number of rows.
|
||||
/// We will find a column with minimum <compressed_size, type_size, uncompressed_size>.
|
||||
|
@ -0,0 +1 @@
|
||||
2
|
@ -0,0 +1,9 @@
|
||||
drop table if exists t;
|
||||
|
||||
create table t(id UInt32) engine MergeTree order by id;
|
||||
|
||||
insert into t values (1);
|
||||
|
||||
select count() from t array join range(2) as a settings optimize_trivial_count_query = 1;
|
||||
|
||||
drop table t;
|
Loading…
Reference in New Issue
Block a user