mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #52432 from amosbird/fix_52405
Fix normal projection with merge table
This commit is contained in:
commit
e3c85613c9
@ -92,6 +92,10 @@ bool optimizeUseNormalProjections(Stack & stack, QueryPlan::Nodes & nodes)
|
||||
break;
|
||||
}
|
||||
|
||||
/// Dangling query plan node. This might be generated by StorageMerge.
|
||||
if (iter->node->step.get() == reading)
|
||||
return false;
|
||||
|
||||
const auto metadata = reading->getStorageMetadata();
|
||||
const auto & projections = metadata->projections;
|
||||
|
||||
@ -105,8 +109,8 @@ bool optimizeUseNormalProjections(Stack & stack, QueryPlan::Nodes & nodes)
|
||||
|
||||
QueryDAG query;
|
||||
{
|
||||
auto & clild = iter->node->children[iter->next_child - 1];
|
||||
if (!query.build(*clild))
|
||||
auto & child = iter->node->children[iter->next_child - 1];
|
||||
if (!query.build(*child))
|
||||
return false;
|
||||
|
||||
if (query.dag)
|
||||
|
@ -0,0 +1 @@
|
||||
1 2
|
@ -0,0 +1,11 @@
|
||||
drop table if exists t;
|
||||
|
||||
create table t (x Int32, codectest Int32) engine = MergeTree order by x;
|
||||
|
||||
alter table t add projection x (select * order by codectest);
|
||||
|
||||
insert into t values (1, 2);
|
||||
|
||||
select * from merge('', 't');
|
||||
|
||||
drop table t;
|
Loading…
Reference in New Issue
Block a user