Github user tedyu commented on a diff in the pull request:
https://github.com/apache/spark/pull/12915#discussion_r62265808
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
---
@@ -330,19 +334,21 @@ class SessionCatalog(
* the same name, then, if that does not exist, return the table from
the current database.
*/
def lookupRelation(name: TableIdentifier, alias: Option[String] = None):
LogicalPlan = {
- val db = name.database.getOrElse(currentDb)
- val table = formatTableName(name.table)
- val relation =
- if (name.database.isDefined || !tempTables.contains(table)) {
- val metadata = externalCatalog.getTable(db, table)
- SimpleCatalogRelation(db, metadata, alias)
- } else {
- tempTables(table)
- }
- val qualifiedTable = SubqueryAlias(table, relation)
- // 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 => SubqueryAlias(a,
qualifiedTable)).getOrElse(qualifiedTable)
+ synchronized {
+ val db = name.database.getOrElse(currentDb)
+ val table = formatTableName(name.table)
+ val relation =
+ if (name.database.isDefined || !tempTables.contains(table)) {
+ val metadata = externalCatalog.getTable(db, table)
+ SimpleCatalogRelation(db, metadata, alias)
+ } else {
+ tempTables(table)
+ }
+ val qualifiedTable = SubqueryAlias(table, relation)
--- End diff --
nit: look like this call and alias.map() can be outside the synchronized
block.
---
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]