diff options
author | Michael Armbrust <michael@databricks.com> | 2015-06-14 11:21:42 -0700 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-06-14 11:21:42 -0700 |
commit | 9073a426e444e4bc6efa8608e54e0a986f38a270 (patch) | |
tree | 73e63b53adf62ee38ae66c7ba91280a0c1509e01 /sql/catalyst | |
parent | ea7fd2ff6454e8d819a39bf49901074e49b5714e (diff) | |
download | spark-9073a426e444e4bc6efa8608e54e0a986f38a270.tar.gz spark-9073a426e444e4bc6efa8608e54e0a986f38a270.tar.bz2 spark-9073a426e444e4bc6efa8608e54e0a986f38a270.zip |
[SPARK-8358] [SQL] Wait for child resolution when resolving generators
Author: Michael Armbrust <michael@databricks.com>
Closes #6811 from marmbrus/aliasExplodeStar and squashes the following commits:
fbd2065 [Michael Armbrust] more style
806a373 [Michael Armbrust] fix style
7cbb530 [Michael Armbrust] [SPARK-8358][SQL] Wait for child resolution when resolving generatorsa
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala index cbd8def4f1..4b7fef7126 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala @@ -563,7 +563,9 @@ class Analyzer( private object AliasedGenerator { def unapply(e: Expression): Option[(Generator, Seq[String])] = e match { case Alias(g: Generator, name) - if g.elementTypes.size > 1 && java.util.regex.Pattern.matches("_c[0-9]+", name) => { + if g.resolved && + g.elementTypes.size > 1 && + java.util.regex.Pattern.matches("_c[0-9]+", name) => { // Assume the default name given by parser is "_c[0-9]+", // TODO in long term, move the naming logic from Parser to Analyzer. // In projection, Parser gave default name for TGF as does for normal UDF, @@ -572,7 +574,7 @@ class Analyzer( // Let's simply ignore the default given name for this case. Some((g, Nil)) } - case Alias(g: Generator, name) if g.elementTypes.size > 1 => + case Alias(g: Generator, name) if g.resolved && g.elementTypes.size > 1 => // If not given the default names, and the TGF with multiple output columns failAnalysis( s"""Expect multiple names given for ${g.getClass.getName}, |