imback82 commented on a change in pull request #26684: [WIP][SPARK-30001][SQL]
ResolveRelations should handle both V1 and V2 tables.
URL: https://github.com/apache/spark/pull/26684#discussion_r350989245
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
##########
@@ -747,26 +747,33 @@ class SessionCatalog(
}.getOrElse(throw new NoSuchTableException(db, table))
} else if (name.database.isDefined || !tempViews.contains(table)) {
val metadata = externalCatalog.getTable(db, table)
- if (metadata.tableType == CatalogTableType.VIEW) {
- val viewText = metadata.viewText.getOrElse(sys.error("Invalid view
without text."))
- logDebug(s"'$viewText' will be used for the view($table).")
- // The relation is a view, so we wrap the relation by:
- // 1. Add a [[View]] operator over the relation to keep track of the
view desc;
- // 2. Wrap the logical plan in a [[SubqueryAlias]] which tracks the
name of the view.
- val child = View(
- desc = metadata,
- output = metadata.schema.toAttributes,
- child = parser.parsePlan(viewText))
- SubqueryAlias(table, db, child)
- } else {
- SubqueryAlias(table, db, UnresolvedCatalogRelation(metadata))
- }
+ createRelation(name, metadata)
} else {
SubqueryAlias(table, tempViews(table))
}
}
}
+ def createRelation(name: TableIdentifier, metadata: CatalogTable):
LogicalPlan = {
Review comment:
`lookupRelation` above is not used anywhere else, so we can just rename this
to `lookupRelation`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]