Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/3131#discussion_r20036066
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
@@ -68,19 +66,25 @@ private[hive] class HiveMetastoreCatalog(hive:
HiveContext) extends Catalog with
tableName: String,
alias: Option[String]): LogicalPlan = synchronized {
val (databaseName, tblName) = processDatabaseAndTableName(
-
db.getOrElse(hive.sessionState.getCurrentDatabase), tableName)
+ db.getOrElse(hive.sessionState.getCurrentDatabase), tableName)
val table = client.getTable(databaseName, tblName)
- val partitions: Seq[Partition] =
- if (table.isPartitioned) {
- HiveShim.getAllPartitionsOf(client, table).toSeq
- } else {
- Nil
- }
+ if (table.isView) {
+ // if the unresolved relation is from hive view
+ // parse the text into logic node.
+ HiveQl.createPlanForView(table, alias)
--- End diff --
In general it is up to the catalog to apply `Subquery` for `aliases`, at
least I think thats what we are doing elsewhere. It would be good to stay
consistent unless there is some reason to change so I'm inclined to agree with
@chenghao-intel.
Also I'm a little confused about where the lowercasing is happening? I
agree that sort of logic belongs in the analyzer and not in the catalog.
(Though maybe that comment is just stale?)
---
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]