Closed
Description
release-5.3
create table t(a float,b double);
alter table t set tiflash replica 2;
insert into t values(0.1,0.2),(0.2,0.2);
set @@tidb_enforce_mpp=on;
select count(*) from t group by a having case when count(*) then sum(b) else 'a' end; -- expect 1,1 ; but got empty result
/*
mysql> explain select count(*) from t group by a having case when count(*) then sum(b) else 'a' end;
+----------------------------------------+---------+-------------------+---------------+----------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------------------+---------+-------------------+---------------+----------------------------------------------------------------------------------------------+
| TableReader_48 | 1.28 | root | | data:ExchangeSender_47 |
| └─ExchangeSender_47 | 1.28 | batchCop[tiflash] | | ExchangeType: PassThrough |
| └─Projection_7 | 1.28 | batchCop[tiflash] | | Column#4 |
| └─Selection_39 | 1.28 | batchCop[tiflash] | | case(Column#4, cast(Column#5, var_string(5)), "a") |
| └─Projection_43 | 1.60 | batchCop[tiflash] | | Column#4, Column#5 |
| └─HashAgg_44 | 1.60 | batchCop[tiflash] | | group by:aggregation2.t.a, funcs:sum(Column#13)->Column#4, funcs:sum(Column#14)->Column#5 |
| └─ExchangeReceiver_46 | 1.60 | batchCop[tiflash] | | |
| └─ExchangeSender_45 | 1.60 | batchCop[tiflash] | | ExchangeType: HashPartition, Hash Cols: [name: aggregation2.t.a, collate: N/A] |
| └─HashAgg_41 | 1.60 | batchCop[tiflash] | | group by:aggregation2.t.a, funcs:count(1)->Column#13, funcs:sum(aggregation2.t.b)->Column#14 |
| └─TableFullScan_29 | 2.00 | batchCop[tiflash] | table:t | keep order:false, stats:pseudo |
+----------------------------------------+---------+-------------------+---------------+----------------------------------------------------------------------------------------------+
10 rows in set (0.04 sec)
Activity