fix multiple usages of 'IN' operator with the same set

This commit is contained in:
Anton Popov 2020-05-06 03:53:59 +03:00
parent 114f09cfca
commit 19528007fd
3 changed files with 18 additions and 1 deletions

View File

@ -409,7 +409,7 @@ bool ExpressionAnalyzer::makeAggregateDescriptions(ExpressionActionsPtr & action
for (size_t i = 0; i < arguments.size(); ++i) for (size_t i = 0; i < arguments.size(); ++i)
{ {
getRootActions(arguments[i], true, actions); getRootActionsNoMakeSet(arguments[i], true, actions);
const std::string & name = arguments[i]->getColumnName(); const std::string & name = arguments[i]->getColumnName();
types[i] = actions->getSampleBlock().getByName(name).type; types[i] = actions->getSampleBlock().getByName(name).type;
aggregate.argument_names[i] = name; aggregate.argument_names[i] = name;

View File

@ -0,0 +1,5 @@
2
2
2
1
1

View File

@ -0,0 +1,12 @@
drop table if exists test;
create table test (project LowCardinality(String)) engine=MergeTree() order by project;
insert into test values ('val1'), ('val2'), ('val3');
select sum(project in ('val1', 'val2')) from test;
set force_primary_key = 1;
select sum(project in ('val1', 'val2')) from test where project in ('val1', 'val2');
select count() from test where project in ('val1', 'val2');
select project in ('val1', 'val2') from test where project in ('val1', 'val2');
drop table test;