HiveClient — Contract for Retrieving Metadata from Hive Metastore

HiveClient is the contract for…​FIXME

Note
HiveClientImpl is the only available HiveClient in Spark SQL.

HiveClient offers safe variants of many methods that do not report exceptions when a relational entity is not found in a Hive metastore, e.g. getTableOption for getTable.

package org.apache.spark.sql.hive.client

trait HiveClient {
  // only required methods that have no implementation
  // FIXME List of the methods
  def alterPartitions(
      db: String,
      table: String,
      newParts: Seq[CatalogTablePartition]): Unit
  def getTableOption(dbName: String, tableName: String): Option[CatalogTable]
  def getPartitions(
      catalogTable: CatalogTable,
      partialSpec: Option[TablePartitionSpec] = None): Seq[CatalogTablePartition]
  def getPartitionsByFilter(
      catalogTable: CatalogTable,
      predicates: Seq[Expression]): Seq[CatalogTablePartition]
  def getPartitionOption(
      table: CatalogTable,
      spec: TablePartitionSpec): Option[CatalogTablePartition]
  def renamePartitions(
      db: String,
      table: String,
      specs: Seq[TablePartitionSpec],
      newSpecs: Seq[TablePartitionSpec]): Unit
}
Table 1. (Subset of) HiveClient Contract
Method Description

alterPartitions

getPartitions

getPartitions(
  db: String,
  table: String,
  partialSpec: Option[TablePartitionSpec]): Seq[CatalogTablePartition]
getPartitions(
  catalogTable: CatalogTable,
  partialSpec: Option[TablePartitionSpec] = None): Seq[CatalogTablePartition]

Returns the CatalogTablePartition of a table

Used exclusively when HiveExternalCatalog is requested to list the partitions of a table

getPartitionsByFilter

Used when…​FIXME

getPartitionOption

Used when…​FIXME

getTableOption

getTableOption(
  dbName: String,
  tableName: String): Option[CatalogTable]

Retrieves a table metadata from a Hive metastore

Used when HiveClient is requested for a table metadata

renamePartitions

Used when…​FIXME

version

Hive version

Retrieving Table Metadata From Hive Metastore — getTable Method

getTable(
  dbName: String,
  tableName: String): CatalogTable

getTable retrieves the table metadata from a Hive metastore if available or throws a NoSuchTableException.

Note

getTable is used when:

results matching ""

    No results matching ""