Class HiveCatalog

java.lang.Object
org.apache.iceberg.BaseMetastoreCatalog
org.apache.iceberg.view.BaseMetastoreViewCatalog
org.apache.iceberg.hive.HiveCatalog
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.conf.Configurable, org.apache.iceberg.catalog.Catalog, org.apache.iceberg.catalog.SupportsNamespaces, org.apache.iceberg.catalog.ViewCatalog

public class HiveCatalog extends org.apache.iceberg.view.BaseMetastoreViewCatalog implements org.apache.iceberg.catalog.SupportsNamespaces, org.apache.hadoop.conf.Configurable
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.iceberg.view.BaseMetastoreViewCatalog

    org.apache.iceberg.view.BaseMetastoreViewCatalog.BaseMetastoreViewCatalogTableBuilder, org.apache.iceberg.view.BaseMetastoreViewCatalog.BaseViewBuilder

    Nested classes/interfaces inherited from class org.apache.iceberg.BaseMetastoreCatalog

    org.apache.iceberg.BaseMetastoreCatalog.BaseMetastoreCatalogTableBuilder

    Nested classes/interfaces inherited from interface org.apache.iceberg.catalog.Catalog

    org.apache.iceberg.catalog.Catalog.TableBuilder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.iceberg.catalog.Catalog.TableBuilder
    buildTable(org.apache.iceberg.catalog.TableIdentifier identifier, org.apache.iceberg.Schema schema)
     
    org.apache.iceberg.view.ViewBuilder
    buildView(org.apache.iceberg.catalog.TableIdentifier identifier)
     
    void
     
    void
    createNamespace(org.apache.iceberg.catalog.Namespace namespace, Map<String,String> meta)
     
    protected String
    defaultWarehouseLocation(org.apache.iceberg.catalog.TableIdentifier tableIdentifier)
     
    boolean
    dropNamespace(org.apache.iceberg.catalog.Namespace namespace)
     
    boolean
    dropTable(org.apache.iceberg.catalog.TableIdentifier identifier, boolean purge)
     
    boolean
    dropView(org.apache.iceberg.catalog.TableIdentifier identifier)
     
    org.apache.hadoop.conf.Configuration
     
    void
    initialize(String inputName, Map<String,String> properties)
     
    protected boolean
    isValidIdentifier(org.apache.iceberg.catalog.TableIdentifier tableIdentifier)
     
    List<org.apache.iceberg.catalog.Namespace>
    listNamespaces(org.apache.iceberg.catalog.Namespace namespace)
     
    List<org.apache.iceberg.catalog.TableIdentifier>
    listTables(org.apache.iceberg.catalog.Namespace namespace)
     
    List<org.apache.iceberg.catalog.TableIdentifier>
    listViews(org.apache.iceberg.catalog.Namespace namespace)
     
    loadNamespaceMetadata(org.apache.iceberg.catalog.Namespace namespace)
     
     
    org.apache.iceberg.TableOperations
    newTableOps(org.apache.iceberg.catalog.TableIdentifier tableIdentifier)
     
    protected org.apache.iceberg.view.ViewOperations
    newViewOps(org.apache.iceberg.catalog.TableIdentifier identifier)
     
    protected Map<String,String>
     
    org.apache.iceberg.Table
    registerTable(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation)
    Register a table with the catalog if it does not exist.
    boolean
    removeProperties(org.apache.iceberg.catalog.Namespace namespace, Set<String> properties)
     
    void
    renameTable(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier originalTo)
     
    void
    renameView(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier to)
     
    void
    setConf(org.apache.hadoop.conf.Configuration conf)
     
    boolean
    setProperties(org.apache.iceberg.catalog.Namespace namespace, Map<String,String> properties)
     
    boolean
    tableExists(org.apache.iceberg.catalog.TableIdentifier identifier)
    Check whether table or metadata table exists.
     
    boolean
    viewExists(org.apache.iceberg.catalog.TableIdentifier viewIdentifier)
     

    Methods inherited from class org.apache.iceberg.view.BaseMetastoreViewCatalog

    loadView, registerView

    Methods inherited from class org.apache.iceberg.BaseMetastoreCatalog

    fullTableName, isValidMetadataIdentifier, loadTable, metricsReporter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.iceberg.catalog.Catalog

    createTable, createTable, createTable, createTable, dropTable, invalidateTable, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, registerTable

    Methods inherited from interface org.apache.iceberg.catalog.SupportsNamespaces

    createNamespace, listNamespaces, namespaceExists

    Methods inherited from interface org.apache.iceberg.catalog.ViewCatalog

    invalidateView
  • Field Details

  • Constructor Details

    • HiveCatalog

      public HiveCatalog()
  • Method Details

    • initialize

      public void initialize(String inputName, Map<String,String> properties)
      Specified by:
      initialize in interface org.apache.iceberg.catalog.Catalog
      Specified by:
      initialize in interface org.apache.iceberg.catalog.ViewCatalog
      Overrides:
      initialize in class org.apache.iceberg.view.BaseMetastoreViewCatalog
    • buildTable

      public org.apache.iceberg.catalog.Catalog.TableBuilder buildTable(org.apache.iceberg.catalog.TableIdentifier identifier, org.apache.iceberg.Schema schema)
      Specified by:
      buildTable in interface org.apache.iceberg.catalog.Catalog
      Overrides:
      buildTable in class org.apache.iceberg.view.BaseMetastoreViewCatalog
    • buildView

      public org.apache.iceberg.view.ViewBuilder buildView(org.apache.iceberg.catalog.TableIdentifier identifier)
      Specified by:
      buildView in interface org.apache.iceberg.catalog.ViewCatalog
      Overrides:
      buildView in class org.apache.iceberg.view.BaseMetastoreViewCatalog
    • listTables

      public List<org.apache.iceberg.catalog.TableIdentifier> listTables(org.apache.iceberg.catalog.Namespace namespace)
      Specified by:
      listTables in interface org.apache.iceberg.catalog.Catalog
    • listViews

      public List<org.apache.iceberg.catalog.TableIdentifier> listViews(org.apache.iceberg.catalog.Namespace namespace)
      Specified by:
      listViews in interface org.apache.iceberg.catalog.ViewCatalog
    • name

      public String name()
      Specified by:
      name in interface org.apache.iceberg.catalog.Catalog
      Specified by:
      name in interface org.apache.iceberg.catalog.ViewCatalog
      Overrides:
      name in class org.apache.iceberg.view.BaseMetastoreViewCatalog
    • dropTable

      public boolean dropTable(org.apache.iceberg.catalog.TableIdentifier identifier, boolean purge)
      Specified by:
      dropTable in interface org.apache.iceberg.catalog.Catalog
    • dropView

      public boolean dropView(org.apache.iceberg.catalog.TableIdentifier identifier)
      Specified by:
      dropView in interface org.apache.iceberg.catalog.ViewCatalog
    • renameTable

      public void renameTable(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier originalTo)
      Specified by:
      renameTable in interface org.apache.iceberg.catalog.Catalog
    • renameView

      public void renameView(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier to)
      Specified by:
      renameView in interface org.apache.iceberg.catalog.ViewCatalog
    • tableExists

      public boolean tableExists(org.apache.iceberg.catalog.TableIdentifier identifier)
      Check whether table or metadata table exists.

      Note: If a hive table with the same identifier exists in catalog, this method will return false.

      Specified by:
      tableExists in interface org.apache.iceberg.catalog.Catalog
      Parameters:
      identifier - a table identifier
      Returns:
      true if the table exists, false otherwise
    • viewExists

      public boolean viewExists(org.apache.iceberg.catalog.TableIdentifier viewIdentifier)
      Specified by:
      viewExists in interface org.apache.iceberg.catalog.ViewCatalog
    • createNamespace

      public void createNamespace(org.apache.iceberg.catalog.Namespace namespace, Map<String,String> meta)
      Specified by:
      createNamespace in interface org.apache.iceberg.catalog.SupportsNamespaces
    • listNamespaces

      public List<org.apache.iceberg.catalog.Namespace> listNamespaces(org.apache.iceberg.catalog.Namespace namespace)
      Specified by:
      listNamespaces in interface org.apache.iceberg.catalog.SupportsNamespaces
    • dropNamespace

      public boolean dropNamespace(org.apache.iceberg.catalog.Namespace namespace)
      Specified by:
      dropNamespace in interface org.apache.iceberg.catalog.SupportsNamespaces
    • setProperties

      public boolean setProperties(org.apache.iceberg.catalog.Namespace namespace, Map<String,String> properties)
      Specified by:
      setProperties in interface org.apache.iceberg.catalog.SupportsNamespaces
    • removeProperties

      public boolean removeProperties(org.apache.iceberg.catalog.Namespace namespace, Set<String> properties)
      Specified by:
      removeProperties in interface org.apache.iceberg.catalog.SupportsNamespaces
    • loadNamespaceMetadata

      public Map<String,String> loadNamespaceMetadata(org.apache.iceberg.catalog.Namespace namespace)
      Specified by:
      loadNamespaceMetadata in interface org.apache.iceberg.catalog.SupportsNamespaces
    • isValidIdentifier

      protected boolean isValidIdentifier(org.apache.iceberg.catalog.TableIdentifier tableIdentifier)
      Overrides:
      isValidIdentifier in class org.apache.iceberg.BaseMetastoreCatalog
    • newTableOps

      public org.apache.iceberg.TableOperations newTableOps(org.apache.iceberg.catalog.TableIdentifier tableIdentifier)
      Specified by:
      newTableOps in class org.apache.iceberg.BaseMetastoreCatalog
    • newViewOps

      protected org.apache.iceberg.view.ViewOperations newViewOps(org.apache.iceberg.catalog.TableIdentifier identifier)
      Specified by:
      newViewOps in class org.apache.iceberg.view.BaseMetastoreViewCatalog
    • defaultWarehouseLocation

      protected String defaultWarehouseLocation(org.apache.iceberg.catalog.TableIdentifier tableIdentifier)
      Specified by:
      defaultWarehouseLocation in class org.apache.iceberg.BaseMetastoreCatalog
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.iceberg.BaseMetastoreCatalog
    • setConf

      public void setConf(org.apache.hadoop.conf.Configuration conf)
      Specified by:
      setConf in interface org.apache.hadoop.conf.Configurable
    • getConf

      public org.apache.hadoop.conf.Configuration getConf()
      Specified by:
      getConf in interface org.apache.hadoop.conf.Configurable
    • properties

      protected Map<String,String> properties()
      Overrides:
      properties in class org.apache.iceberg.BaseMetastoreCatalog
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class org.apache.iceberg.BaseMetastoreCatalog
      Throws:
      IOException
    • registerTable

      public org.apache.iceberg.Table registerTable(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation)
      Register a table with the catalog if it does not exist. This is overridden in order to add view existence detection before registering a table.
      Specified by:
      registerTable in interface org.apache.iceberg.catalog.Catalog
      Overrides:
      registerTable in class org.apache.iceberg.BaseMetastoreCatalog
      Parameters:
      identifier - a table identifier
      metadataFileLocation - the location of a metadata file
      Returns:
      a Table instance
      Throws:
      org.apache.iceberg.exceptions.AlreadyExistsException - if a table or view with the same identifier already exists in the catalog.