Skip to content

Uncertain Results by MERGE_JOIN #46580

@bajinsheng

Description

@bajinsheng

Bug Report

1. Minimal reproduce step (Required)

CREATE TABLE t0(c0 INT);
CREATE TABLE t1(c0 BOOL, c1 BOOL);
INSERT INTO t1 VALUES (false, true);
INSERT INTO t1 VALUES (true, true);
CREATE VIEW v0(c0, c1, c2) AS SELECT t1.c0, LOG10(t0.c0), t1.c0 FROM t0, t1;
INSERT INTO t0(c0) VALUES (3);

SELECT /*+ MERGE_JOIN(t1, t0, v0)*/v0.c2, t1.c0 FROM v0,  t0 CROSS JOIN t1 ORDER BY -v0.c1;

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

3. What did you see instead (Required)

Executing the above test case multiple times and the results are not the same.
Sometimes it returns:

c2      c0
1       0
0       0
1       1
0       1

Sometimes it returns empty: {}.

4. What is your TiDB version? (Required)

| Release Version: v7.4.0-alpha-239-g4f2f5e1061
Edition: Community
Git Commit Hash: 4f2f5e1
Git Branch: master
UTC Build Time: 2023-08-30 12:06:00
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: unistore |

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions