Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/15936#discussion_r88947150
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -1244,6 +1244,23 @@ class Analyzer(
case s @ ScalarSubquery(sub, conditions, exprId)
if sub.resolved && conditions.isEmpty && sub.output.size != 1
=>
failAnalysis(s"Scalar subquery must return only one column, but
got ${sub.output.size}")
+ // SPARK-1854: block cases where GROUP BY columns
+ // are not part of the correlated columns
+ case s @ ScalarSubquery(sub, conditions, exprId)
--- End diff --
BTW: we should not assume that an aggregate is always the top-level node
for a correlated scalar subquery. We add a projection to the subquery plan when
it shares attributes with the outer plan. This is solved in CheckAnalysis.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]