Skip to content

TiFlash join may got wrong result if fine grained join is enabled, and multiple join key has different types #59877

@windtalker

Description

@windtalker

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table t1(id bigint, v1 int);
Query OK, 0 rows affected (0.04 sec)

mysql> create table t2(id bigint unsigned, v1 int);
Query OK, 0 rows affected (0.05 sec)

mysql> create table t3(id bigint, v1 int);
Query OK, 0 rows affected (0.05 sec)

mysql> insert into t1 values(10001, 1);
Query OK, 1 row affected (0.01 sec)

mysql> insert into t2 values(10001, 2);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t3 values(10001, 3);
Query OK, 1 row affected (0.01 sec)

mysql> set tidb_broadcast_join_threshold_size=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set tidb_broadcast_join_threshold_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> alter table t1 set tiflash replica 1;
Query OK, 0 rows affected (0.06 sec)

mysql> alter table t2 set tiflash replica 1;
Query OK, 0 rows affected (0.04 sec)

mysql> alter table t3 set tiflash replica 1;
Query OK, 0 rows affected (0.06 sec)

mysql> set tidb_enforce_mpp=1;
Query OK, 0 rows affected (0.01 sec)

mysql> set tiflash_fine_grained_shuffle_stream_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql>  select /*+ hash_join_build(t3) */ count(*) from t1 straight_join t2 on t1.id = t2.id straight_join t3 on t1.id = t3.id;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.03 sec)

mysql> set tiflash_fine_grained_shuffle_stream_count=-1;
Query OK, 0 rows affected (0.00 sec)

mysql>  select /*+ hash_join_build(t3) */ count(*) from t1 straight_join t2 on t1.id = t2.id straight_join t3 on t1.id = t3.id;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.07 sec)

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

Labels

affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.report/customerCustomers have encountered this bug.severity/criticalsig/executionSIG executiontype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions