cloud-fan commented on a change in pull request #32787:
URL: https://github.com/apache/spark/pull/32787#discussion_r660349216
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
##########
@@ -807,4 +807,48 @@ class AnalysisErrorSuite extends AnalysisTest {
// UnresolvedHint be removed by batch `Remove Unresolved Hints`
assertAnalysisSuccess(plan, true)
}
+
+ test("SPARK-35618: Resolve star expressions in subqueries") {
+ val a = AttributeReference("a", IntegerType)()
+ val b = AttributeReference("b", IntegerType)()
+ val t0 = OneRowRelation()
+ val t1 = LocalRelation(a, b).as("t1")
+
+ // t1.* in the subquery should be resolved into outer(t1.a) and
outer(t1.b).
+ assertAnalysisError(
+ Project(ScalarSubquery(t0.select(star("t1"))).as("sub") :: Nil, t1),
+ "Scalar subquery must return only one column, but got 2" :: Nil)
+
+ // array(t1.*) in the subquery should be resolved into array(outer(t1.a),
outer(t1.b))
+ val array = CreateArray(Seq(star("t1")))
+ assertAnalysisError(
+ Project(ScalarSubquery(t0.select(array)).as("sub") :: Nil, t1),
+ "Expressions referencing the outer query are not supported" :: Nil)
Review comment:
hmm, I think we do support star in `CreateArray`?
https://github.com/apache/spark/pull/32787/files#diff-c00a384380a1462ecad9fca0fed853c47d6894867420f7daf94b1c56ae444e4bR226
--
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]