some adjacent projection is redundant and unnecessary
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
```
drop table if exists t;
create table t(a int primary key, b int);
insert into t values (1, 11), (4, 44), (2, 22), (3, 33);
set session tidb_executor_concurrency = 4;
set @@session.tidb_hash_join_concurrency = 5;
set @@session.tidb_distsql_scan_concurrency = 15;
mysql> explain select sum(a) from t group by a, a+b order by a;
+----------------------------+---------+-----------+---------------+----------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------+---------+-----------+---------------+----------------------------------------------------------+
| Projection_7 | 4.00 | root | | Column#3->Column#4 |
| └─Projection_13 | 4.00 | root | | cast(test.t.a, decimal(32,0) BINARY)->Column#3, test.t.a |
| └─TableReader_15 | 4.00 | root | | data:TableFullScan_14 |
| └─TableFullScan_14 | 4.00 | cop[tikv] | table:t | keep order:true, stats:pseudo |
+----------------------------+---------+-----------+---------------+----------------------------------------------------------+
4 rows in set (0.00 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.