Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build rollup plan case index out of range #54983

Closed
AilinKid opened this issue Jul 29, 2024 · 0 comments · Fixed by #54988
Closed

build rollup plan case index out of range #54983

AilinKid opened this issue Jul 29, 2024 · 0 comments · Fixed by #54988
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. impact/panic severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@AilinKid
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t1(
product VARCHAR(32),
country_id INTEGER NOT NULL,
year INTEGER,
profit INTEGER);
INSERT INTO t1  VALUES ( 'Computer', 2,2000, 1200),
( 'TV', 1, 1999, 150),
( 'Calculator', 1, 1999,50),
( 'Computer', 1, 1999,1500),
( 'Computer', 1, 2000,1500),
( 'TV', 1, 2000, 150),
( 'TV', 2, 2000, 100),
( 'TV', 2, 2000, 100),
( 'Calculator', 1, 2000,75),
( 'Calculator', 2, 2000,75),
( 'TV', 1, 1999, 100),
( 'Computer', 1, 1999,1200),
( 'Computer', 2, 2000,1500),
( 'Calculator', 2, 2000,75),
( 'Phone', 3, 2003,10)
;
CREATE TABLE t2 (
country_id INTEGER PRIMARY KEY,
country CHAR(20) NOT NULL);
INSERT INTO t2 VALUES (1, 'USA'),(2,'India'), (3,'Finland');

SELECT product FROM t1 WHERE EXISTS (SELECT product, country_id , SUM(profit) FROM t1 AS t2  WHERE t1.product=t2.product GROUP BY product, country_id WITH ROLLUP  HAVING SUM(profit) > 6000);

2. What did you expect to see? (Required)

success

3. What did you see instead (Required)

tidb> SELECT product FROM t1 WHERE EXISTS (SELECT product, country_id , SUM(profit) FROM t1 AS t2  WHERE t1.product=t2.product GROUP BY product, country_id WITH ROLLUP  HAVING SUM(profit) > 6000);
No connection. Trying to reconnect...
Connection id:    2097154
Current database: test

ERROR 1105 (HY000): runtime error: index out of range [0] with length 0

4. What is your TiDB version? (Required)

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. impact/panic severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants