got incorrect result while using cross join
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
--------------------
SELECT SUM(t.ROWN+t2.ROWN) FROM(
SELECT
@ROWN := @ROWN + 1 AS ROWN
FROM
(
SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
) t,
( SELECT @ROWN :=- 1 ) r
) t
JOIN(
SELECT
@ROWN := @ROWN + 1 AS ROWN
FROM
(
SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
) t,
( SELECT @ROWN :=- 1 ) r
) t2
--------------------
```
### 2. What did you expect to see? (Required)
the result should be 1900
### 3. What did you see instead (Required)
got different result(like 1540,1710,1900...) while running many times
### 4. What is your TiDB version? (Required)
Release Version: v5.3.0
Edition: Community
Git Commit Hash: 4a1b2e9fe5b5afb1068c56de47adb07098d768d6
Git Branch: heads/refs/tags/v5.3.0
UTC Build Time: 2021-11-24 13:32:39
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
Contributor guide
Assessment
This issue has not been assessed yet.