-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
runtime error: index out of range [0] with length 0 #27135
Comments
There is a syntax error in this sql, can you check it? |
|
tidb config
error info
|
Hi @jingshanglu , I don't think this is critical: it doesn't lead to a wrong result. 'major' may be a better choice. |
Tested on 37e0dac, this problem has been fixed. CREATE TABLE `tbl_19` (
`col_0` binary(163) NOT NULL DEFAULT 'LSfT\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`col_1` varchar(446) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'GvVvyqoovQuXCwxO',
`col_2` varchar(14) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`col_3` tinyint(1) DEFAULT NULL,
`col_4` datetime NOT NULL DEFAULT '2028-11-20 00:00:00',
`col_5` smallint(5) unsigned NOT NULL DEFAULT '34044',
`col_6` time NOT NULL DEFAULT '17:29:24',
`col_7` enum('Alice','Bob','Charlie','David') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'David',
`col_8` time DEFAULT '14:37:55',
`col_9` timestamp NOT NULL,
PRIMARY KEY (`col_9`,`col_7`,`col_0`,`col_1`,`col_2`,`col_6`,`col_5`) /*T![clustered_index] NONCLUSTERED */,
UNIQUE KEY `idx_1` (`col_0`,`col_5`),
KEY `idx_2` (`col_9`,`col_8`,`col_4`,`col_6`,`col_3`,`col_2`,`col_5`,`col_7`,`col_0`)
);
CREATE TABLE `tbl_22` (
`col_134` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`col_134`) /*T![clustered_index] CLUSTERED */,
KEY `idx_42` (`col_134`),
UNIQUE KEY `idx_43` (`col_134`),
UNIQUE KEY `idx_44` (`col_134`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
PARTITION BY RANGE ( `col_134` ) (
PARTITION `p0` VALUES LESS THAN (207),
PARTITION `p1` VALUES LESS THAN (245),
PARTITION `p2` VALUES LESS THAN (MAXVALUE)
);
insert into tbl_22 values(16),(18),(64),(113),(120),(145),(147),(240);
insert into tbl_19 values('mffzfkkdc','eb' ,'jcvrals',1,'2009-08-01 00:00:00',17826,'14:22:51','David','00:48:07','1979-06-20 00:00:00'),('LSfT' ,'GvVvyqoovQuXCwxO','' ,0,'2028-11-20 00:00:00',34044,'17:29:24','David','14:37:55','1992-01-07 00:00:00'); tidb config:
tidb> set @@tidb_partition_prune_mode = 'dynamic';
tidb> select /*+ inl_join(@sel_1 tbl_22@sel_2) */ tbl_19.* from tbl_19 where col_5 in ( select col_134 from tbl_22 where tbl_19.col_5 between 19961 and 64474 );
Empty set (0.00 sec)
tidb> desc select /*+ inl_join(@sel_1 tbl_22@sel_2) */ tbl_19.* from tbl_19 where col_5 in ( select col_134 from tbl_22 where tbl_19.col_5 between 19961 and 64474 );
+------------------------------+---------+-----------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+------------------------------+---------+-----------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| IndexJoin_11 | 0.04 | root | | semi join, inner:TableReader_10, outer key:test.tbl_19.col_5, inner key:test.tbl_22.col_134, equal cond:eq(test.tbl_19.col_5, test.tbl_22.col_134) |
| ├─TableReader_16(Build) | 0.05 | root | | data:Selection_15 |
| │ └─Selection_15 | 0.05 | cop[tikv] | | ge(test.tbl_19.col_5, 19961), le(test.tbl_19.col_5, 64474) |
| │ └─TableFullScan_14 | 2.00 | cop[tikv] | table:tbl_19 | keep order:false, stats:pseudo |
| └─TableReader_10(Probe) | 1.00 | root | partition:all | data:TableRangeScan_9 |
| └─TableRangeScan_9 | 1.00 | cop[tikv] | table:tbl_22 | range: decided by [test.tbl_19.col_5], keep order:false, stats:pseudo |
+------------------------------+---------+-----------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ |
Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
select excute success;
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: