Wrong returned exception from tiflash when table has virtual column that's generated by no other columns
- 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)
```sql
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (
c0 NUMERIC ZEROFILL AS (1) VIRTUAL
);
ALTER TABLE t0 SET TIFLASH REPLICA 1;
SELECT /*+ read_from_storage(tikv[t0]) */
t0.c0
FROM t0
WHERE c0 != NULL
ORDER BY (1 = ((t0.c0 <= 1))) DESC;
SELECT /*+ read_from_storage(tiflash[t0]) */
t0.c0
FROM t0
WHERE c0 != NULL
ORDER BY (1 = ((t0.c0 <= 1))) DESC;
```
### 2. What did you expect to see? (Required)
The same behavior between two queries
### 3. What did you see instead (Required)
```sql
mysql> SELECT /*+ read_from_storage(tikv[t0]) */
-> t0.c0
-> FROM t0
-> WHERE c0 != NULL
-> ORDER BY (1 = ((t0.c0 <= 1))) DESC;
Empty set (0.04 sec)
mysql> SELECT /*+ read_from_storage(tiflash[t0]) */ t0.c0 FROM t0 WHERE c0 != NULL ORDER BY (1 = ((t0.c0 <= 1))) DESC;
ERROR 1105 (HY000): other error for mpp stream: Code: 0, e.displayText() = DB::TiFlashException: The tidb table scan schema size 1 is different from the tiflash storage schema size 0, table id is 3509, e.what() = DB::TiFlashException,
```
### 4. What is your TiDB version? (Required)
TiDB v8.4.0
Contributor guide
Assessment
This issue has not been assessed yet.