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

incorrect tableDual plan caused by corner case values and partition #49842

Closed
wjhuang2016 opened this issue Dec 27, 2023 · 1 comment · Fixed by #49853 or #50045
Closed

incorrect tableDual plan caused by corner case values and partition #49842

wjhuang2016 opened this issue Dec 27, 2023 · 1 comment · Fixed by #49853 or #50045
Assignees
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. fuzz/randomtest severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t428fc8c8` (
  `col_51` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`col_51`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `idx_28` (`col_51`),
  KEY `idx_29` (`col_51`),
  KEY `idx_31` (`col_51`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY HASH (`col_51`) PARTITIONS 4;
desc SELECT 1  FROM `t428fc8c8` WHERE `t428fc8c8`.`col_51` BETWEEN 9223372036854775807 AND 9223372036854775808;

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

TableScan

3. What did you see instead (Required)

mysql> desc SELECT 1  FROM `t428fc8c8` WHERE `t428fc8c8`.`col_51` BETWEEN 9223372036854775807 AND 9223372036854775808;
+-------------------+---------+------+---------------+---------------+
| id                | estRows | task | access object | operator info |
+-------------------+---------+------+---------------+---------------+
| Projection_6      | 0.00    | root |               | 1->Column#2   |
| └─TableDual_7     | 0.00    | root |               | rows:0        |
+-------------------+---------+------+---------------+---------------+
2 rows in set, 1 warning (0.00 sec)

4. What is your TiDB version? (Required)

cb7d2b7

@wjhuang2016 wjhuang2016 added type/bug The issue is confirmed as a bug. fuzz/randomtest labels Dec 27, 2023
@wjhuang2016
Copy link
Member Author

It's correct if the table is not partition table:

mysql> desc SELECT 1  FROM `t428fc8c8` WHERE `t428fc8c8`.`col_51` BETWEEN 9223372036854775807 AND 9223372036854775808;
+--------------------------+---------+-----------+-----------------+---------------------------------------------------------------------------------+
| id                       | estRows | task      | access object   | operator info                                                                   |
+--------------------------+---------+-----------+-----------------+---------------------------------------------------------------------------------+
| Projection_4             | 1.00    | root      |                 | 1->Column#2                                                                     |
| └─TableReader_6          | 1.00    | root      |                 | data:TableRangeScan_5                                                           |
|   └─TableRangeScan_5     | 1.00    | cop[tikv] | table:t428fc8c8 | range:[9223372036854775807,9223372036854775808], keep order:false, stats:pseudo |
+--------------------------+---------+-----------+-----------------+---------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

@Defined2014 Defined2014 added severity/major component/tablepartition This issue is related to Table Partition of TiDB. labels Dec 27, 2023
@Defined2014 Defined2014 self-assigned this Dec 27, 2023
@Defined2014 Defined2014 added sig/sql-infra SIG: SQL Infra affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 labels Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. fuzz/randomtest severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
2 participants