`Import into xxx from select xxx group by a with thread=x` will report syntax error
- 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
create table t(a int);
insert into t values (1);
create table t1(a int);
import into t1 from select sum(a) from t group by a with thread=1; -- syntax error
import into t1 from select sum(a) from t group by a with rollup with thread=1; -- no error
```
### 2. What did you expect to see? (Required)
no error
### 3. What did you see instead (Required)
report error
### 4. What is your TiDB version? (Required)
```
mysql> select tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.0-alpha-296-g8c888234ff
Edition: Community
Git Commit Hash: 8c888234ff2a6c606593db3d1ebc929f0cd7f876
Git Branch: master
UTC Build Time: 2024-12-09 02:23:26
GoVersion: go1.23.4
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
A workaround way, create a view to instead of directly use group by sql.
Contributor guide
Research direction
Start by running the provided SQL reproduction against the reported TiDB version and compare it with the working ROLLUP variant. Trace the import-from-select handling for GROUP BY and define done as the failing statement completing without a syntax error while preserving the existing workaround behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100