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
}
Note
HiveClient is a private[hive] contract.
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 if available

Used exclusively when HiveClient is requested for a table metadata

Note
getTableOption is a safe version of getTable as it does not throw a NoSuchTableException, but simply returns None.

renamePartitions

Used when…​FIXME

Retrieving Table Metadata If Available or Throwing NoSuchTableException — getTable Method

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

getTable retrieves the metadata of a table in a Hive metastore if available or reports a NoSuchTableException.

Note

getTable is used when:

results matching ""

    No results matching ""