Skip to content

Commit 35d86f3

Browse files
committed
Access TTable directly to make sure Hive will not internally use any metastore utility functions.
1 parent 3737766 commit 35d86f3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,19 @@ private[hive] case class MetastoreRelation
717717
}
718718

719719
// Must be a stable value since new attributes are born here.
720-
val partitionKeys = hiveQlTable.getPartitionKeys.map(_.toAttribute)
721-
720+
// Since we create the TTable inside hiveQlTable manually, we can use TTbale's interface
721+
// to get Partition keys at here. We do this to make sure Hive will not try to use
722+
// any metastore utility functions. All of interactions between metastore and related
723+
// parts should be done through our ClientWrapper.
724+
/** PartitionKey attributes */
725+
val partitionKeys = hiveQlTable.getTTable.getPartitionKeys.map(_.toAttribute)
726+
727+
// Since we create the TTable inside hiveQlTable manually, we can use TTbale's interface
728+
// to get non-partition columns at here. We do this to make sure Hive will not try to use
729+
// any metastore utility functions. All of interactions between metastore and related
730+
// parts should be done through our ClientWrapper.
722731
/** Non-partitionKey attributes */
723-
val attributes = hiveQlTable.getCols.map(_.toAttribute)
732+
val attributes = hiveQlTable.getTTable.getSd.getCols.map(_.toAttribute)
724733

725734
val output = attributes ++ partitionKeys
726735

0 commit comments

Comments
 (0)