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

query failed with index out of range [-1] #28250

Closed
windtalker opened this issue Sep 22, 2021 · 2 comments · Fixed by #28251
Closed

query failed with index out of range [-1] #28250

windtalker opened this issue Sep 22, 2021 · 2 comments · Fixed by #28251
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@windtalker
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> drop table if exists t1;
Query OK, 0 rows affected (0.51 sec)

mysql> drop table if exists t;
Query OK, 0 rows affected (0.52 sec)

mysql> create table t (a int not null, b int, c varchar(20));
Query OK, 0 rows affected (0.51 sec)

mysql> create table t1 (a int, b int not null, c double);
Query OK, 0 rows affected (0.51 sec)

mysql> alter table t set tiflash replica 1;
Query OK, 0 rows affected (0.51 sec)

mysql> alter table t1 set tiflash replica 1;
Query OK, 0 rows affected (0.51 sec)

mysql> explain select count(*) from (select a , b from t union all select a , c from t1 where false) tt;
+------------------------------------+----------+-------------------+---------------+-----------------------------------------------------+
| id                                 | estRows  | task              | access object | operator info                                       |
+------------------------------------+----------+-------------------+---------------+-----------------------------------------------------+
| HashAgg_33                         | 1.00     | root              |               | funcs:count(Column#14)->Column#11                   |
| └─TableReader_35                   | 1.00     | root              |               | data:ExchangeSender_34                              |
|   └─ExchangeSender_34              | 1.00     | batchCop[tiflash] |               | ExchangeType: PassThrough                           |
|     └─HashAgg_15                   | 1.00     | batchCop[tiflash] |               | funcs:count(1)->Column#14                           |
|       └─Union_32                   | 10000.00 | batchCop[tiflash] |               |                                                     |
|         └─Projection_51            | 10000.00 | batchCop[tiflash] |               | cast(Column#9, int(11) BINARY)->Column#9, Column#10 |
|           └─Projection_26          | 10000.00 | batchCop[tiflash] |               | test.t.a, cast(test.t.b, double BINARY)->Column#10  |
|             └─TableFullScan_27     | 10000.00 | batchCop[tiflash] | table:t       | keep order:false, stats:pseudo                      |
+------------------------------------+----------+-------------------+---------------+-----------------------------------------------------+
8 rows in set (0.00 sec)

mysql>  select count(*) from (select a , b from t union all select a , c from t1 where false) tt;
ERROR 1105 (HY000): runtime error: index out of range [-1]

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

query executed without error

3. What did you see instead (Required)

ERROR 1105 (HY000): runtime error: index out of range [-1]

4. What is your TiDB version? (Required)

master@38e90ad13657ebe2cd2e2a2832aba26130b75e64

@yudongusa
Copy link

@windtalker assigning this issue to you as you've been fixing it via #28251

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
4 participants