Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/16514#discussion_r95287862 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala --- @@ -119,7 +119,31 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log qualifiedTableName.database, qualifiedTableName.name) if (DDLUtils.isDatasourceTable(table)) { - val dataSourceTable = cachedDataSourceTables(qualifiedTableName) + val dataSourceTable = + cachedDataSourceTables(qualifiedTableName) match { + case l @ LogicalRelation(relation: HadoopFsRelation, _, _) => + val location = table.storage.locationUri + val cachedLocation = relation.location.rootPaths + val isSamePath = location.isDefined && cachedLocation.size == 1 && --- End diff -- The size of `cachedLocation` is always 1, because we rely on [resolveRelation](https://github.com/gatorsmile/spark/blob/f6b88e6595271dbd6c868f7e220ba480872e1a9f/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala#L88) to build the cached LogicalRelation. In the resolveRelation, the [rootPaths is always pointing to a single file](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala#L368).
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org