[SPARK-35545][FOLLOW-UP][TEST][SQL] Add a regression test for the SubqueryExpression refactor
### What changes were proposed in this pull request? Add a test. ### Why are the changes needed? The SubqueryExpression refactor PR https://github.com/apache/spark/pull/32687 actually fixes the bug of `SubqueryExpression.references`. So this follow-up PR adds a regression unit test for it. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added a new test. Closes #32990 from Ngone51/spark-35545-followup. Authored-by: yi.wu <yi.wu@databricks.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
This commit is contained in:
parent
682e7f2033
commit
974d127c4f
|
@ -4018,6 +4018,30 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
|
|||
val minuteToSecDF = spark.sql("SELECT INTERVAL '10:03.775808000' MINUTE TO SECOND")
|
||||
assert(minuteToSecDF.schema.head.dataType === DayTimeIntervalType(2, 3))
|
||||
}
|
||||
|
||||
test("SPARK-35545: split SubqueryExpression's children field into outer attributes and " +
|
||||
"join conditions") {
|
||||
withView("t") {
|
||||
Seq((0, 1), (1, 2)).toDF("c1", "c2").createOrReplaceTempView("t")
|
||||
checkAnswer(sql(
|
||||
s"""with
|
||||
|start as (
|
||||
| select c1, c2 from t A where not exists (
|
||||
| select * from t B where A.c1 = B.c1 - 2
|
||||
| )
|
||||
|),
|
||||
|
|
||||
|end as (
|
||||
| select c1, c2 from t A where not exists (
|
||||
| select * from t B where A.c1 < B.c1
|
||||
| )
|
||||
|)
|
||||
|
|
||||
|select * from start S join end E on S.c1 = E.c1
|
||||
|""".stripMargin),
|
||||
Row(1, 2, 1, 2) :: Nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case class Foo(bar: Option[String])
|
||||
|
|
Loading…
Reference in a new issue