File tree Expand file tree Collapse file tree 1 file changed +20
-21
lines changed
sql/core/src/test/scala/org/apache/spark/sql Expand file tree Collapse file tree 1 file changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -1879,27 +1879,26 @@ class SubquerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
1879
1879
}
1880
1880
1881
1881
test(" SPARK-36280: Remove redundant aliases after RewritePredicateSubquery" ) {
1882
- sql( " CREATE TABLE t1 USING parquet AS SELECT id AS a, id AS b, id AS c FROM range(10) " )
1883
- sql(" CREATE TABLE t2 USING parquet AS SELECT id AS x , id AS y FROM range(8 )" )
1884
- val df = sql(
1885
- """
1886
- |SELECT *
1887
- |FROM t1
1888
- |WHERE a IN (SELECT x
1889
- | FROM (SELECT x AS x,
1890
- | Rank()
1891
- | OVER (
1892
- | PARTITION BY x
1893
- | ORDER BY Sum(y) DESC) AS ranking
1894
- | FROM t2
1895
- | GROUP BY x) tmp1
1896
- | WHERE ranking <= 5)
1897
- | """ .stripMargin )
1898
-
1899
- df.collect()
1900
- val exchanges = collect(df.queryExecution.executedPlan) {
1901
- case s : ShuffleExchangeExec => s
1882
+ withTable( " t1 " , " t2 " ) {
1883
+ sql(" CREATE TABLE t1 USING parquet AS SELECT id AS a , id AS b, id AS c FROM range(10 )" )
1884
+ sql(" CREATE TABLE t2 USING parquet AS SELECT id AS x, id AS y FROM range(8) " )
1885
+ val df = sql(
1886
+ """
1887
+ |SELECT *
1888
+ |FROM t1
1889
+ |WHERE a IN (SELECT x
1890
+ | FROM (SELECT x AS x,
1891
+ | RANK() OVER (PARTITION BY x ORDER BY SUM(y) DESC) AS ranking
1892
+ | FROM t2
1893
+ | GROUP BY x) tmp1
1894
+ | WHERE ranking <= 5)
1895
+ | """ .stripMargin)
1896
+
1897
+ df.collect( )
1898
+ val exchanges = collect(df.queryExecution.executedPlan) {
1899
+ case s : ShuffleExchangeExec => s
1900
+ }
1901
+ assert(exchanges.size === 1 )
1902
1902
}
1903
- assert(exchanges.size === 1 )
1904
1903
}
1905
1904
}
You can’t perform that action at this time.
0 commit comments