rollup MPP can't be generated caused by root-only expression / operator
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
```
CREATE TABLE `t` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
alter table t set tiflash replica 2;
MySQL [test]> SELECT (SELECT b) AS col1, COUNT(*) FROM t GROUP BY col1 WITH ROLLUP;
ERROR 1815 (HY000): Internal : Can't find a proper physical plan for this query
see that plan explanation without ROLLUP
MySQL [test]> SELECT (SELECT b) AS col1, COUNT(*) FROM t GROUP BY col1
+-----------------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-----------------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------+
| Projection_13 | 4.00 | root | | test.t.b, Column#5 |
| └─HashJoin_14 | 4.00 | root | | CARTESIAN left outer join |
| ├─TableDual_26(Build) | 1.00 | root | | rows:1 |
| └─HashAgg_16(Probe) | 4.00 | root | | group by:test.t.b, funcs:count(1)->Column#5, funcs:firstrow(test.t.b)->test.t.b |
| └─HashJoin_17 | 5.00 | root | | CARTESIAN left outer join |
| ├─TableDual_24(Build) | 1.00 | root | | rows:1 |
| └─TableReader_20(Probe) | 5.00 | root | | data:TableFullScan_19 |
| └─TableFullScan_19 | 5.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+-----------------------------------+---------+-----------+---------------+---------------------------------------------------------------------------------+
8 rows in set (0.001 sec)
```
Now, ROLLUP OP can only be run on Tiflash node as MPP plan, when its children has some root-only expression/operator (like table dual here), its mpp physical enumeration is blocked.
Contributor guide
Assessment
This issue has not been assessed yet.