diff options
author | jerryshao <saisai.shao@intel.com> | 2014-03-30 10:03:58 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-03-30 10:04:28 -0700 |
commit | 95d7d2a3fc2adc0bbca90d015c6ca319fffb26aa (patch) | |
tree | 67f21ae7e2d4dc07c6e16c59cc3a0f7f9d70c1f8 /sql/catalyst | |
parent | df1b9f7b1a07bf8d806695a7684f9d69bf705093 (diff) | |
download | spark-95d7d2a3fc2adc0bbca90d015c6ca319fffb26aa.tar.gz spark-95d7d2a3fc2adc0bbca90d015c6ca319fffb26aa.tar.bz2 spark-95d7d2a3fc2adc0bbca90d015c6ca319fffb26aa.zip |
[SPARK-1354][SQL] Add tableName as a qualifier for SimpleCatelogy
Fix attribute unresolved when query with table name as a qualifier in SQLContext with SimplCatelog, details please see [SPARK-1354](https://issues.apache.org/jira/browse/SPARK-1354?jql=project%20%3D%20SPARK).
Author: jerryshao <saisai.shao@intel.com>
Closes #272 from jerryshao/qualifier-fix and squashes the following commits:
7950170 [jerryshao] Add tableName as a qualifier for SimpleCatelogy
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Catalog.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Catalog.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Catalog.scala index ff66177a03..e09182dd8d 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Catalog.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Catalog.scala @@ -47,10 +47,11 @@ class SimpleCatalog extends Catalog { tableName: String, alias: Option[String] = None): LogicalPlan = { val table = tables.get(tableName).getOrElse(sys.error(s"Table Not Found: $tableName")) + val tableWithQualifiers = Subquery(tableName, table) // If an alias was specified by the lookup, wrap the plan in a subquery so that attributes are // properly qualified with this alias. - alias.map(a => Subquery(a.toLowerCase, table)).getOrElse(table) + alias.map(a => Subquery(a.toLowerCase, tableWithQualifiers)).getOrElse(tableWithQualifiers) } } |