Skip to content

Inconsistent result of the same queries, related to index merge, null #41273

Closed
@wjhuang2016

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `87f3b2f7` (
  `12db5ecc` set('nwbk','r5','1ad3u','van','ir1z','y','9m','f1','z','e6yd','wfev') NOT NULL DEFAULT 'ir1z,f1,e6yd',
  `0a968b42` enum('soo2','4s4j','qi9om','8ue','i71o','qon','3','3feh','6o1i','5yebx','d') NOT NULL DEFAULT '8ue',
  `af528200` varchar(66) DEFAULT '13mdezixgcn',
  PRIMARY KEY (`12db5ecc`,`0a968b42`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `e521f911` (`0a968b42`),
  KEY `17d3c2c4` (`12db5ecc`)
) ENGINE=InnoDB DEFAULT CHARSET=ascii COLLATE=ascii_bin COMMENT='9302fd19';

INSERT INTO `87f3b2f7` VALUES('ir1z,f1,e6yd','i71o','13mdezixgcn'),('ir1z,f1,e6yd','d','13mdezixgcn'),('nwbk','8ue','13mdezixgcn');

select     trim( `87f3b2f7`.`12db5ecc` ) as r0 , var_samp( `87f3b2f7`.`0a968b42` ) as r1 from `87f3b2f7` where `87f3b2f7`.`12db5ecc` between 'e6yd' and 'z' or `87f3b2f7`.`0a968b42` <> '8ue' group by `87f3b2f7`.`12db5ecc`  order by r0,r1;

select  /*+ use_index_merge( `87f3b2f7` ) */ /*+ agg_to_cop() stream_agg() */  trim( `87f3b2f7`.`12db5ecc` ) as r0 , var_samp( `87f3b2f7`.`0a968b42` ) as r1 from `87f3b2f7` where `87f3b2f7`.`12db5ecc` between 'e6yd' and 'z' or `87f3b2f7`.`0a968b42` <> '8ue' group by `87f3b2f7`.`12db5ecc`  order by r0,r1;

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

Two queries got the same results.

3. What did you see instead (Required)

mysql> select  /*+ use_index_merge( `87f3b2f7` ) */ /*+ agg_to_cop() stream_agg() */  trim( `87f3b2f7`.`12db5ecc` ) as r0 , var_samp( `87f3b2f7`.`0a968b42` ) as r1 from `87f3b2f7` where `87f3b2f7`.`12db5ecc` between 'e6yd' and 'z' or `87f3b2f7`.`0a968b42` <> '8ue' group by `87f3b2f7`.`12db5ecc`  order by r0,r1;
+--------------+------+
| r0           | r1   |
+--------------+------+
| ir1z,f1,e6yd |   18 |
+--------------+------+
1 row in set (0.01 sec)

mysql> select     trim( `87f3b2f7`.`12db5ecc` ) as r0 , var_samp( `87f3b2f7`.`0a968b42` ) as r1 from `87f3b2f7` where `87f3b2f7`.`12db5ecc` between 'e6yd' and 'z' or `87f3b2f7`.`0a968b42` <> '8ue' group by `87f3b2f7`.`12db5ecc`  order by r0,r1;
+--------------+------+
| r0           | r1   |
+--------------+------+
| ir1z,f1,e6yd |   18 |
| nwbk         | NULL |
+--------------+------+
2 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

master

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions