pingcap / pingcap/tidb

final mode scalar agg function does not push down tiflash, and without warnings

Open
#50,583 4 comments 0 reactions 1 assignee Claimed by @AilinKid View on GitHub
affects-8.1 affects-8.5 may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 severity/major sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
```
DROP TABLE IF EXISTS c_t2;
CREATE TABLE `c_t2` (
`c1` int(11) DEFAULT NULL,
`c2` varchar(50) DEFAULT NULL,
`c3` varchar(1) NOT NULL DEFAULT 'N',
`c4` varchar(32) NOT NULL DEFAULT 'sys',
`c5` varchar(32) NOT NULL DEFAULT 'sys',
`c6` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`c7` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`c8` bigint(20) NOT NULL DEFAULT '0',
`c9` varchar(50) DEFAULT NULL
);
ALTER TABLE c_t2 SET TIFLASH REPLICA 1;

set tidb_allow_mpp=1;set tidb_enforce_mpp=1; set tidb_isolation_read_engines='tiflash';
explain
select
GROUP_CONCAT(
'"',
replace(c9, '*', '_'),
'":',
c1,
''
)
from
c_t2;
```

### 2. What did you expect to see? (Required)
final mode `group_concat` push down tiflash

### 3. What did you see instead (Required)
```
+--------------------------------+----------+--------------+---------------+---------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+--------------------------------+----------+--------------+---------------+---------------------------------------------------------------------------------------+
| HashAgg_17 | 1.00 | root | | funcs:group_concat(Column#12 separator ",")->Column#11 |
| └─TableReader_19 | 1.00 | root | | MppVersion: 2, data:ExchangeSender_18 |
| └─ExchangeSender_18 | 1.00 | mpp[tiflash] | | ExchangeType: PassThrough |
| └─HashAgg_9 | 1.00 | mpp[tiflash] | | funcs:group_concat(""", Column#14, "":", Column#15, "" separator ",")->Column#12 |
| └─Projection_28 | 10000.00 | mpp[tiflash] | | replace(test.c_t2.c9, *, _)->Column#14, cast(test.c_t2.c1, var_string(20))->Column#15 |
| └─TableFullScan_16 | 10000.00 | mpp[tiflash] | table:c_t2 | keep order:false, stats:pseudo |
+--------------------------------+----------+--------------+---------------+---------------------------------------------------------------------------------------+
```

### 4. What is your TiDB version? (Required)

Git Commit Hash: 7ba2330394bcfa1dcd321293c2656604c3a664ab

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.