allisonwang-db commented on code in PR #38135:
URL: https://github.com/apache/spark/pull/38135#discussion_r1000040515
##########
sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala:
##########
@@ -2044,19 +2034,13 @@ class SubquerySuite extends QueryTest
|FROM (SELECT CAST(c1 AS STRING) a FROM t1)
|""".stripMargin),
Row(5) :: Row(null) :: Nil)
- val exception1 = intercept[AnalysisException] {
- sql(
- """SELECT (SELECT SUM(c2) FROM t2 WHERE CAST(c1 AS SHORT) = a)
- |FROM (SELECT CAST(c1 AS SHORT) a FROM t1)""".stripMargin)
- }
- checkErrorMatchPVals(
- exception1,
- errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY." +
- "CORRELATED_COLUMN_IS_NOT_ALLOWED_IN_PREDICATE",
- parameters = Map("treeNode" -> "(?s).*"),
- sqlState = None,
- context = ExpectedContext(
- fragment = "SELECT SUM(c2) FROM t2 WHERE CAST(c1 AS SHORT) = a",
start = 8, stop = 57))
+ // SPARK-36114: we now allow non-safe cast expressions in correlated
predicates.
+ val df = sql(
+ """SELECT (SELECT SUM(c2) FROM t2 WHERE CAST(c1 AS SHORT) = a)
+ |FROM (SELECT CAST(c1 AS SHORT) a FROM t1)
+ |""".stripMargin)
+ checkAnswer(df, Row(5) :: Row(null) :: Nil)
+ checkNumJoins(df.queryExecution.optimizedPlan, 2)
Review Comment:
I am verifying the optimized plan should have 1 left outer join and 1 domain
(inner) join.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]