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

In function returned incorrect result when in-list contains two arguments and one is column #8169

Closed
yibin87 opened this issue Oct 9, 2023 · 3 comments · Fixed by #8171 or #8172
Closed
Labels
affects-7.4 component/storage priority/P1 The issue has P1 priority. severity/critical type/bug The issue is confirmed as a bug.

Comments

@yibin87
Copy link
Contributor

yibin87 commented Oct 9, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table a (col0 integer, col1 integer);
mysql> insert into a values(20, 30);
mysql> insert into a values(40, 50);
mysql> insert into a values(null, null);
mysql> alter table a set tiflash replica 1;
mysql> set session tidb_isolation_read_engines='tiflash';
mysql> select * from a where col0 in (null, col0);

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

+------+------+
| col0 | col1 |
+------+------+
| 20 | 30 |
| 40 | 50 |
+------+------+

3. What did you see instead (Required)

Empty set.

4. What is your TiFlash version? (Required)

master, commit hash: 6918946

@yibin87
Copy link
Contributor Author

yibin87 commented Oct 9, 2023

v.7.4.0 reproduced this issue.

@yibin87
Copy link
Contributor Author

yibin87 commented Oct 9, 2023

May need to run set session tidb_isolation_read_engines='tikv'; set session tidb_isolation_read_engines='tiflash'; several times to reproduce this issue.

@yibin87
Copy link
Contributor Author

yibin87 commented Oct 9, 2023

From explain analyze results, it seems RSFilter filters all rows:

mysql> explain analyze select * from a where col0 in (null, col0);

+----------------------------+---------+---------+--------------+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------+-----------+------+
| id                         | estRows | actRows | task         | access object | execution info                                                                                                                                                                                                                                                                                                                                                                                                          | operator info                                            | memory    | disk |
+----------------------------+---------+---------+--------------+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------+-----------+------+
| TableReader_13             | 2.40    | 0       | root         |               | time:7.57ms, loops:1, RU:0.000000, cop_task: {num: 1, max: 0s, proc_keys: 0, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                                                | MppVersion: 2, data:ExchangeSender_12                    | 305 Bytes | N/A  |
| └─ExchangeSender_12        | 2.40    | 0       | mpp[tiflash] |               | tiflash_task:{time:5.96ms, loops:0, threads:8}                                                                                                                                                                                                                                                                                                                                                                          | ExchangeType: PassThrough                                | N/A       | N/A  |
|   └─Selection_11           | 2.40    | 0       | mpp[tiflash] |               | tiflash_task:{time:5.79ms, loops:0, threads:8}                                                                                                                                                                                                                                                                                                                                                                          | in(test.a.col0, NULL, test.a.col0)                       | N/A       | N/A  |
|     └─TableFullScan_10     | 3.00    | 0       | mpp[tiflash] | table:a       | tiflash_task:{time:5.79ms, loops:0, threads:8}, tiflash_scan:{dtfile:{total_scanned_packs:0, total_skipped_packs:1, total_scanned_rows:0, total_skipped_rows:3, total_rs_index_check_time: 0ms, total_read_time: 0ms, total_disagg_read_cache_hit_size: 0, total_disagg_read_cache_miss_size: 0}, total_create_snapshot_time: 0ms, total_local_region_num: 1, total_remote_region_num: 0, total_learner_read_time: 0ms} | pushed down filter:empty, keep order:false, stats:pseudo | N/A       | N/A  |
+----------------------------+---------+---------+--------------+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------+-----------+------+
4 rows in set (0.01 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.4 component/storage priority/P1 The issue has P1 priority. severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
1 participant