Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use the "raw" not ("preprocessed") table name in MetastoreRelation
  • Loading branch information
mbautin authored and markhamstra committed Nov 4, 2015
commit c2efd24bf6ca2e8325c8388ac34057760af2b082
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
val databaseName = tableIdent.lift(tableIdent.size - 2).getOrElse(
client.currentDatabase)
val rawTableName = tableIdent.last
val tblName = tableNamePreprocessor(rawTableName)
val table = client.getTable(databaseName, tblName).withTableName(rawTableName)
val tblNameInMetastore = tableNamePreprocessor(rawTableName)
val table = client.getTable(databaseName, tblNameInMetastore).withTableName(rawTableName)

if (table.properties.get("spark.sql.sources.provider").isDefined) {
val dataSourceTable =
cachedDataSourceTables(QualifiedTableName(databaseName, tblName).toLowerCase)
cachedDataSourceTables(QualifiedTableName(databaseName, tblNameInMetastore).toLowerCase)
// Then, if alias is specified, wrap the table with a Subquery using the alias.
// Otherwise, wrap the table with a Subquery using the table name.
val withAlias =
Expand All @@ -431,7 +431,7 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
case Some(aliasText) => Subquery(aliasText, HiveQl.createPlan(viewText))
}
} else {
MetastoreRelation(databaseName, tblName, alias)(table)(hive)
MetastoreRelation(databaseName, rawTableName, alias)(table)(hive)
}
}

Expand Down