Skip to content

incorrect tableDual plan which would cause no result #50051

@wjhuang2016

Description

@wjhuang2016

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t5cb5d4a7` (   `col_12` binary(172) NOT NULL,   `col_13` bigint(20) unsigned NOT NULL,   KEY `idx_2` (`col_12`,`col_13`),   PRIMARY KEY (`col_13`,`col_12`)  ,   KEY `idx_5` (`col_13`,`col_12`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
desc SELECT 1 FROM `t5cb5d4a7` WHERE `t5cb5d4a7`.`col_13`>9223372036854775807 AND `t5cb5d4a7`.`col_13`>8900084226548014260;

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

TableRangeScan

3. What did you see instead (Required)

mysql> desc SELECT 1 FROM `t5cb5d4a7` WHERE `t5cb5d4a7`.`col_13`>9223372036854775807 AND `t5cb5d4a7`.`col_13`>8900084226548014260;
+-------------------+---------+------+---------------+---------------+
| id                | estRows | task | access object | operator info |
+-------------------+---------+------+---------------+---------------+
| Projection_4      | 3333.33 | root |               | 1->Column#3   |
| └─TableDual_5     | 3333.33 | root |               | rows:0        |
+-------------------+---------+------+---------------+---------------+
2 rows in set (0.00 sec)

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

mysql> desc SELECT 1 FROM `t5cb5d4a7` WHERE `t5cb5d4a7`.`col_13`>8900084226548014260;
+--------------------------+---------+-----------+-----------------+------------------------------------------------------------------+
| id                       | estRows | task      | access object   | operator info                                                    |
+--------------------------+---------+-----------+-----------------+------------------------------------------------------------------+
| Projection_4             | 3333.33 | root      |                 | 1->Column#3                                                      |
| └─TableReader_6          | 3333.33 | root      |                 | data:TableRangeScan_5                                            |
|   └─TableRangeScan_5     | 3333.33 | cop[tikv] | table:t5cb5d4a7 | range:(8900084226548014260,+inf], keep order:false, stats:pseudo |
+--------------------------+---------+-----------+-----------------+------------------------------------------------------------------+
3 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

33480e8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions