Skip to content

Commit f834156

Browse files
cloud-fanHyukjinKwon
authored andcommitted
[MINOR][TEST][SQL] Make in-limit.sql more robust
### What changes were proposed in this pull request? For queries like `t1d in (SELECT t2d FROM t2 ORDER BY t2c LIMIT 2)`, the result can be non-deterministic as the result of the subquery may output different results (it's not sorted by `t2d` and it has shuffle). This PR makes the test more robust by sorting the output column. ### Why are the changes needed? avoid flaky test ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? N/A Closes #28976 from cloud-fan/small. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
1 parent 45fe6b6 commit f834156

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sql/core/src/test/resources/sql-tests/inputs/subquery/in-subquery/in-limit.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ SELECT Count(DISTINCT( t1a )),
7272
FROM t1
7373
WHERE t1d IN (SELECT t2d
7474
FROM t2
75-
ORDER BY t2c
75+
ORDER BY t2c, t2d
7676
LIMIT 2)
7777
GROUP BY t1b
7878
ORDER BY t1b DESC NULLS FIRST
@@ -93,7 +93,7 @@ SELECT Count(DISTINCT( t1a )),
9393
FROM t1
9494
WHERE t1d NOT IN (SELECT t2d
9595
FROM t2
96-
ORDER BY t2b DESC nulls first
96+
ORDER BY t2b DESC nulls first, t2d
9797
LIMIT 1)
9898
GROUP BY t1b
9999
ORDER BY t1b NULLS last

sql/core/src/test/resources/sql-tests/results/subquery/in-subquery/in-limit.sql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ SELECT Count(DISTINCT( t1a )),
103103
FROM t1
104104
WHERE t1d IN (SELECT t2d
105105
FROM t2
106-
ORDER BY t2c
106+
ORDER BY t2c, t2d
107107
LIMIT 2)
108108
GROUP BY t1b
109109
ORDER BY t1b DESC NULLS FIRST
@@ -136,7 +136,7 @@ SELECT Count(DISTINCT( t1a )),
136136
FROM t1
137137
WHERE t1d NOT IN (SELECT t2d
138138
FROM t2
139-
ORDER BY t2b DESC nulls first
139+
ORDER BY t2b DESC nulls first, t2d
140140
LIMIT 1)
141141
GROUP BY t1b
142142
ORDER BY t1b NULLS last

0 commit comments

Comments
 (0)