diff options
author | Dilip Biswal <dbiswal@us.ibm.com> | 2016-03-09 21:49:37 +0800 |
---|---|---|
committer | Wenchen Fan <wenchen@databricks.com> | 2016-03-09 21:49:37 +0800 |
commit | 53ba6d6e59d1172035c2d5e2906bb03fd1998e14 (patch) | |
tree | 6ac1395c6a08080f23e647399b8173b9273d0851 /sql/catalyst | |
parent | 8e8633e0b23a08cdcddcf3c5e8fd0ba3b337e389 (diff) | |
download | spark-53ba6d6e59d1172035c2d5e2906bb03fd1998e14.tar.gz spark-53ba6d6e59d1172035c2d5e2906bb03fd1998e14.tar.bz2 spark-53ba6d6e59d1172035c2d5e2906bb03fd1998e14.zip |
[SPARK-13698][SQL] Fix Analysis Exceptions when Using Backticks in Generate
## What changes were proposed in this pull request?
Analysis exception occurs while running the following query.
```
SELECT ints FROM nestedArray LATERAL VIEW explode(a.b) `a` AS `ints`
```
```
Failed to analyze query: org.apache.spark.sql.AnalysisException: cannot resolve '`ints`' given input columns: [a, `ints`]; line 1 pos 7
'Project ['ints]
+- Generate explode(a#0.b), true, false, Some(a), [`ints`#8]
+- SubqueryAlias nestedarray
+- LocalRelation [a#0], [[[[1,2,3]]]]
```
## How was this patch tested?
Added new unit tests in SQLQuerySuite and HiveQlSuite
Author: Dilip Biswal <dbiswal@us.ibm.com>
Closes #11538 from dilipbiswal/SPARK-13698.
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/CatalystQl.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/CatalystQl.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/CatalystQl.scala index 5d96d8e192..b1b449a0b3 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/CatalystQl.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/CatalystQl.scala @@ -899,10 +899,16 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C } val attributes = clauses.collect { - case Token(a, Nil) => UnresolvedAttribute(a.toLowerCase) + case Token(a, Nil) => UnresolvedAttribute(cleanIdentifier(a.toLowerCase)) } - Generate(generator, join = true, outer = outer, Some(alias.toLowerCase), attributes, child) + Generate( + generator, + join = true, + outer = outer, + Some(cleanIdentifier(alias.toLowerCase)), + attributes, + child) } protected def nodeToGenerator(node: ASTNode): Generator = noParseRule("Generator", node) |