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

SQL failed with "ERROR 1105 (HY000): runtime error: index out of range [1] with length 1" when tidb_enable_inl_join_inner_multi_pattern is ON #54535

Closed
joechenrh opened this issue Jul 10, 2024 · 0 comments · Fixed by #54534
Labels

Comments

@joechenrh
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set GLOBAL tidb_enable_inl_join_inner_multi_pattern='ON';
create table ta(a1 int, a2 int, a3 int, index idx_a(a1));
create table tb(b1 int, b2 int, b3 int, index idx_b(b1));
explain SELECT /*+ inl_join(tmp) */ * FROM ta, (SELECT b1, COUNT(b3) AS cnt FROM tb GROUP BY b1, b2) as tmp where ta.a1 = tmp.b1;

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

Output physical plan like

+-----------------------------------+---------+-----------+---------------------------+-----------------------------------------------------------------------------------------------------------------+
| id                                | estRows | task      | access object             | operator info                                                                                                   |
+-----------------------------------+---------+-----------+---------------------------+-----------------------------------------------------------------------------------------------------------------+
| Projection_9                      | 3.00    | root      |                           | test.ta.a1, test.ta.a2, test.ta.a3, test.tb.b1, Column#9                                                        |
| └─IndexJoin_16                    | 3.00    | root      |                           | inner join, inner:HashAgg_14, outer key:test.ta.a1, inner key:test.tb.b1, equal cond:eq(test.ta.a1, test.tb.b1) |
|   ├─TableReader_43(Build)         | 3.00    | root      |                           | data:Selection_42                                                                                               |
|   │ └─Selection_42                | 3.00    | cop[tikv] |                           | not(isnull(test.ta.a1))                                                                                         |
|   │   └─TableFullScan_41          | 3.00    | cop[tikv] | table:ta                  | keep order:false, stats:pseudo                                                                                  |
|   └─HashAgg_14(Probe)             | 19.16   | root      |                           | group by:test.tb.b1, test.tb.b2, funcs:count(Column#11)->Column#9, funcs:firstrow(test.tb.b1)->test.tb.b1       |
|     └─IndexLookUp_15              | 19.16   | root      |                           |                                                                                                                 |
|       ├─Selection_12(Build)       | 3.00    | cop[tikv] |                           | not(isnull(test.tb.b1))                                                                                         |
|       │ └─IndexRangeScan_10       | 3.00    | cop[tikv] | table:tb, index:idx_b(b1) | range: decided by [eq(test.tb.b1, test.ta.a1)], keep order:false, stats:pseudo                                  |
|       └─HashAgg_13(Probe)         | 19.16   | cop[tikv] |                           | group by:test.tb.b1, test.tb.b2, funcs:count(test.tb.b3)->Column#11                                             |
|         └─TableRowIDScan_11       | 3.00    | cop[tikv] | table:tb                  | keep order:false, stats:pseudo                                                                                  |
+-----------------------------------+---------+-----------+---------------------------+-----------------------------------------------------------------------------------------------------------------+

3. What did you see instead (Required)

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

4. What is your TiDB version? (Required)

v8.2.0-alpha-557-g07bc0d09e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants