-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
set tidb_partition_prune_mode dynamic,IndexJoin return incorrect record #33231
Comments
Some updates: There is something wrong with the
Another update: The result of |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
set @@session.tidb_partition_prune_mode = 'dynamic';
drop table t1,t2;
create table t1 (c_int int, c_str varchar(40), primary key (c_int, c_str) clustered, key(c_int) ) partition by hash (c_int) partitions 4 ;
create table t2 like t1 ;
insert into t1 values(6, 'beautiful curran');
insert into t1 values(7, 'epic kalam');
insert into t1 values(7, 'affectionate curie');
insert into t2 values(6, 'vigorous rhodes');
insert into t2 values(7, 'sweet aryabhata' );
2. What did you expect to see? (Required)
mysql> select * from t1, t2 where t1.c_int = t2.c_int and t1.c_str <= t2.c_str and t2.c_int in (6, 7, 6);
+-------+--------------------+-------+-----------------+
| c_int | c_str | c_int | c_str |
+-------+--------------------+-------+-----------------+
| 6 | beautiful curran | 6 | vigorous rhodes |
| 7 | affectionate curie | 7 | sweet aryabhata |
| 7 | epic kalam | 7 | sweet aryabhata |
+-------+--------------------+-------+-----------------+
3 rows in set (0.01 sec)
3. What did you see instead (Required)
mysql> select * from t1, t2 where t1.c_int = t2.c_int and t1.c_str <= t2.c_str and t2.c_int in (6, 7, 6);
+-------+--------------------+-------+-----------------+
| c_int | c_str | c_int | c_str |
+-------+--------------------+-------+-----------------+
| 6 | beautiful curran | 6 | vigorous rhodes |
| 7 | affectionate curie | 7 | sweet aryabhata |
| 7 | affectionate curie | 7 | sweet aryabhata |
| 7 | epic kalam | 7 | sweet aryabhata |
| 7 | epic kalam | 7 | sweet aryabhata |
+-------+--------------------+-------+-----------------+
5 rows in set (0.00 sec)
mysql> explain select * from t1, t2 where t1.c_int = t2.c_int and t1.c_str <= t2.c_str and t2.c_int in (6, 7, 6);
+-----------------------------+---------+-----------+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-----------------------------+---------+-----------+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| IndexJoin_13 | 25.00 | root | | inner join, inner:TableReader_12, outer key:test1.t1.c_int, inner key:test1.t2.c_int, equal cond:eq(test1.t1.c_int, test1.t2.c_int), other cond:le(test1.t1.c_str, test1.t2.c_str) |
| ├─TableReader_27(Build) | 20.00 | root | partition:p2,p3 | data:TableRangeScan_26 |
| │ └─TableRangeScan_26 | 20.00 | cop[tikv] | table:t1 | range:[6,6], [7,7], keep order:false, stats:pseudo |
| └─TableReader_12(Probe) | 0.00 | root | partition:p2,p3 | data:Selection_11 |
| └─Selection_11 | 0.00 | cop[tikv] | | in(test1.t2.c_int, 6, 7, 6) |
| └─TableRangeScan_10 | 1.00 | cop[tikv] | table:t2 | range: decided by [test1.t1.c_int], keep order:false, stats:pseudo |
+-----------------------------+---------+-----------+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
6 rows in set, 2 warnings (0.00 sec)
4. What is your TiDB version? (Required)
Release Version: v6.0.0-alpha-115-g80ca34256
Edition: Community
Git Commit Hash: 80ca342
Git Branch: master
UTC Build Time: 2022-03-16 10:26:51
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
The text was updated successfully, but these errors were encountered: