Class HiveClient

  • All Implemented Interfaces:
    CleanerClient, java.io.Closeable, java.lang.AutoCloseable

    public class HiveClient
    extends java.lang.Object
    implements CleanerClient
    • Constructor Summary

      Constructors 
      Constructor Description
      HiveClient​(com.hotels.hcommon.hive.metastore.client.api.CloseableMetaStoreClient client, boolean dryRunEnabled)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean dropPartition​(java.lang.String databaseName, java.lang.String tableName, java.lang.String partitionName)
      Will drop the partition from the table if it exists.
      void dropTable​(java.lang.String databaseName, java.lang.String tableName)
      Will drop the table from the database if it exists.
      java.util.Map<java.lang.String,​java.lang.String> getTableProperties​(java.lang.String databaseName, java.lang.String tableName)  
      boolean tableExists​(java.lang.String databaseName, java.lang.String tableName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HiveClient

        public HiveClient​(com.hotels.hcommon.hive.metastore.client.api.CloseableMetaStoreClient client,
                          boolean dryRunEnabled)
    • Method Detail

      • dropTable

        public void dropTable​(java.lang.String databaseName,
                              java.lang.String tableName)
        Will drop the table from the database if it exists.
        Specified by:
        dropTable in interface CleanerClient
        Parameters:
        databaseName -
        tableName -
      • dropPartition

        public boolean dropPartition​(java.lang.String databaseName,
                                     java.lang.String tableName,
                                     java.lang.String partitionName)
        Will drop the partition from the table if it exists.
        Specified by:
        dropPartition in interface CleanerClient
        Parameters:
        databaseName -
        tableName -
        partitionName - expected format: "event_date=2020-01-01/event_hour=0/event_type=A"
      • tableExists

        public boolean tableExists​(java.lang.String databaseName,
                                   java.lang.String tableName)
        Specified by:
        tableExists in interface CleanerClient
      • getTableProperties

        public java.util.Map<java.lang.String,​java.lang.String> getTableProperties​(java.lang.String databaseName,
                                                                                         java.lang.String tableName)
        Specified by:
        getTableProperties in interface CleanerClient
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable