mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Fix scalar optimization in ALTER
This commit is contained in:
parent
4003dcd12e
commit
c0e3564ff5
@ -558,6 +558,10 @@ ASTPtr MutationsInterpreter::prepareInterpreterSelectQuery(std::vector<Stage> &
|
|||||||
all_asts->children.push_back(std::make_shared<ASTIdentifier>(column));
|
all_asts->children.push_back(std::make_shared<ASTIdentifier>(column));
|
||||||
|
|
||||||
auto syntax_result = SyntaxAnalyzer(context).analyze(all_asts, all_columns);
|
auto syntax_result = SyntaxAnalyzer(context).analyze(all_asts, all_columns);
|
||||||
|
if (context.hasQueryContext())
|
||||||
|
for (const auto & it : syntax_result->getScalars())
|
||||||
|
context.getQueryContext().addScalar(it.first, it.second);
|
||||||
|
|
||||||
stage.analyzer = std::make_unique<ExpressionAnalyzer>(all_asts, syntax_result, context);
|
stage.analyzer = std::make_unique<ExpressionAnalyzer>(all_asts, syntax_result, context);
|
||||||
|
|
||||||
ExpressionActionsChain & actions_chain = stage.expressions_chain;
|
ExpressionActionsChain & actions_chain = stage.expressions_chain;
|
||||||
|
@ -47,7 +47,7 @@ private:
|
|||||||
|
|
||||||
StoragePtr storage;
|
StoragePtr storage;
|
||||||
MutationCommands commands;
|
MutationCommands commands;
|
||||||
const Context & context;
|
Context context;
|
||||||
bool can_execute;
|
bool can_execute;
|
||||||
|
|
||||||
ASTPtr mutation_ast;
|
ASTPtr mutation_ast;
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
drop table if exists cdp_segments;
|
||||||
|
drop table if exists cdp_customers;
|
||||||
|
|
||||||
|
create table cdp_segments (seg_id String, mid_seqs AggregateFunction(groupBitmap, UInt32)) engine=ReplacingMergeTree() order by (seg_id);
|
||||||
|
create table cdp_customers (mid String, mid_seq UInt32) engine=ReplacingMergeTree() order by (mid_seq);
|
||||||
|
alter table cdp_segments update mid_seqs = bitmapOr(mid_seqs, (select groupBitmapState(mid_seq) from cdp_customers where mid in ('6bf3c2ee-2b33-3030-9dc2-25c6c618d141'))) where seg_id = '1234567890';
|
||||||
|
|
||||||
|
drop table cdp_segments;
|
||||||
|
drop table cdp_customers;
|
Loading…
Reference in New Issue
Block a user