Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18185#discussion_r129944781
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -859,6 +859,22 @@ class Analyzer(
// rule: ResolveDeserializer.
case plan if containsDeserializer(plan.expressions) => plan
+ case u @ UnresolvedSubqueryColumnAlias(columnNames, child) if
child.resolved =>
+ // Resolves output attributes if a query has alias names in its
subquery:
+ // e.g., SELECT * FROM (SELECT 1 AS a, 1 AS b) t(col1, col2)
+ val outputAttrs = child.output
+ // Checks if the number of the aliases equals to the number of
output columns
+ // in the subquery.
+ if (columnNames.size != outputAttrs.size) {
+ u.failAnalysis(s"Number of column aliases does not match number
of columns. " +
--- End diff --
Nit: remove the string Interpolator `s`.
---
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]