Skip to content

Commit be2085a

Browse files
committed
Use checkSQL.
1 parent ff156e0 commit be2085a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- This file is automatically generated by LogicalPlanToSQLSuite.
2+
select * from t1 b where exists (select * from t1 a)
3+
--------------------------------------------------------------------------------
4+
SELECT `gen_attr` AS `a` FROM (SELECT `gen_attr` FROM (SELECT `a` AS `gen_attr` FROM `default`.`t1`) AS gen_subquery_0 WHERE EXISTS(SELECT `gen_attr` AS `a` FROM ((SELECT `gen_attr` FROM (SELECT `a` AS `gen_attr` FROM `default`.`t1`) AS gen_subquery_0) AS gen_subquery_1) AS gen_subquery_1)) AS b

sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import scala.util.control.NonFatal
2525
import org.apache.spark.sql.Column
2626
import org.apache.spark.sql.catalyst.parser.ParseException
2727
import org.apache.spark.sql.functions._
28+
import org.apache.spark.sql.internal.SQLConf
2829
import org.apache.spark.sql.test.SQLTestUtils
2930

3031
/**
@@ -929,9 +930,10 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with SQLTestUtils {
929930

930931
test("predicate subquery") {
931932
withTable("t1") {
932-
sql("CREATE TABLE t1(a int)")
933-
val df = sql("select * from t1 b where exists (select * from t1 a)")
934-
new SQLBuilder(df).toSQL
933+
withSQLConf(SQLConf.CROSS_JOINS_ENABLED.key -> "true") {
934+
sql("CREATE TABLE t1(a int)")
935+
checkSQL("select * from t1 b where exists (select * from t1 a)", "predicate_subquery")
936+
}
935937
}
936938
}
937939

0 commit comments

Comments
 (0)