Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17015#discussion_r102821580
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
@@ -100,52 +101,49 @@ private[hive] class
HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
None
}
case _ =>
- logWarning(
-
s"${metastoreRelation.databaseName}.${metastoreRelation.tableName} " +
- s"should be stored as $expectedFileFormat. However, we are
getting " +
- s"a ${relation.fileFormat} from the metastore cache. This
cached " +
- s"entry will be invalidated.")
+ logWarning(s"Table $tableIdentifier should be stored as
$expectedFileFormat. " +
+ s"However, we are getting a ${relation.fileFormat} from the
metastore cache. " +
+ "This cached entry will be invalidated.")
tableRelationCache.invalidate(tableIdentifier)
None
}
case other =>
- logWarning(
-
s"${metastoreRelation.databaseName}.${metastoreRelation.tableName} should be
stored " +
- s"as $expectedFileFormat. However, we are getting a $other
from the metastore cache. " +
- s"This cached entry will be invalidated.")
+ logWarning(s"Table $tableIdentifier should be stored as
$expectedFileFormat. " +
+ s"However, we are getting a $other from the metastore cache. " +
+ "This cached entry will be invalidated.")
tableRelationCache.invalidate(tableIdentifier)
None
}
}
private def convertToLogicalRelation(
- metastoreRelation: MetastoreRelation,
+ relation: CatalogRelation,
options: Map[String, String],
- defaultSource: FileFormat,
fileFormatClass: Class[_ <: FileFormat],
fileType: String): LogicalRelation = {
- val metastoreSchema =
StructType.fromAttributes(metastoreRelation.output)
+ val metastoreSchema = relation.tableMeta.schema
val tableIdentifier =
- QualifiedTableName(metastoreRelation.databaseName,
metastoreRelation.tableName)
- val bucketSpec = None // We don't support hive bucketed tables, only
ones we write out.
+ QualifiedTableName(relation.tableMeta.database,
relation.tableMeta.identifier.table)
val lazyPruningEnabled =
sparkSession.sqlContext.conf.manageFilesourcePartitions
- val result = if (metastoreRelation.hiveQlTable.isPartitioned) {
- val partitionSchema =
StructType.fromAttributes(metastoreRelation.partitionKeys)
-
+ val tablePath = new Path(new URI(relation.tableMeta.location))
+ val result = if (relation.isPartitioned) {
+ val partitionSchema = relation.tableMeta.partitionSchema
val rootPaths: Seq[Path] = if (lazyPruningEnabled) {
- Seq(metastoreRelation.hiveQlTable.getDataLocation)
+ Seq(tablePath)
} else {
// By convention (for example, see CatalogFileIndex), the
definition of a
// partitioned table's paths depends on whether that table has any
actual partitions.
// Partitioned tables without partitions use the location of the
table's base path.
// Partitioned tables with partitions use the locations of those
partitions' data
// locations,_omitting_ the table's base path.
- val paths = metastoreRelation.getHiveQlPartitions().map { p =>
- new Path(p.getLocation)
+ val paths =
sparkSession.sharedState.externalCatalog.listPartitions(
+ tableIdentifier.database, tableIdentifier.name).map { p =>
+ new Path(new URI(p.storage.locationUri.get))
--- End diff --
indent?
---
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]