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

agg_to_cop get panic on partitioned table #16861

Closed
XuHuaiyu opened this issue Apr 27, 2020 · 2 comments · Fixed by #17022
Closed

agg_to_cop get panic on partitioned table #16861

XuHuaiyu opened this issue Apr 27, 2020 · 2 comments · Fixed by #17022
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Apr 27, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. What did you do?

set @@tidb_opt_agg_push_down=1;
CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` tinyint(4) NOT NULL,
  PRIMARY KEY (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY RANGE ( `b` ) (
  PARTITION `p0` VALUES LESS THAN (10),
  PARTITION `p1` VALUES LESS THAN (20),
  PARTITION `p2` VALUES LESS THAN (30),
  PARTITION `p3` VALUES LESS THAN (40),
  PARTITION `p4` VALUES LESS THAN (MAXVALUE)
);
insert into t1 values (0, 0), (1, 1), (1, 2), (1, 3), (2, 4), (2, 5), (2, 6), (3, 7), (3, 10), (3, 11), (12, 12), (12, 13), (14, 14), (14, 15), (20, 20), (20, 21), (20, 22), (23, 23), (23, 24), (23, 25), (31, 30), (31, 31), (31, 32), (33, 33), (33, 34), (33, 35), (36, 36), (80, 80), (90, 90), (100, 100);
select /*+ AGG_TO_COP() */ sum(a), sum(b) from t1 where a < 40 group by a;

2. What did you expect to see?

the query works fine

3. What did you see instead?

tidb>  select /*+ AGG_TO_COP() */ sum(a), sum(b) from t1 where a < 40 group by a;
ERROR 1105 (HY000): runtime error: index out of range [0] with length 0

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

tidb> select tidb_version();
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                        |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.0-beta.2-343-ge607157ef
Git Commit Hash: e607157efef0f76878d18a667b233061ce43545a
Git Branch: master
UTC Build Time: 2020-04-27 06:44:46
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@XuHuaiyu XuHuaiyu added type/bug The issue is confirmed as a bug. sig/execution SIG execution labels Apr 27, 2020
@lzmhhh123
Copy link
Contributor

I can't reproduce in the newest master branch.

@XuHuaiyu
Copy link
Contributor Author

XuHuaiyu commented May 7, 2020

@lzmhhh123
We need to set @@tidb_opt_agg_push_down=1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants