org.apache.falcon.catalog
Class HiveCatalogService

java.lang.Object
  extended by org.apache.falcon.catalog.AbstractCatalogService
      extended by org.apache.falcon.catalog.HiveCatalogService

public class HiveCatalogService
extends AbstractCatalogService

An implementation of CatalogService that uses Hive Meta Store (HCatalog) as the backing Catalog registry.


Constructor Summary
HiveCatalogService()
           
 
Method Summary
 boolean dropPartitions(String catalogUrl, String database, String tableName, Map<String,String> partitions)
          Drops a given partition.
static org.apache.hcatalog.api.HCatClient get(org.apache.falcon.entity.v0.cluster.Cluster cluster)
           
static org.apache.hcatalog.api.HCatClient get(String metastoreUrl)
           
 CatalogPartition getPartition(String catalogUrl, String database, String tableName, Map<String,String> partitionSpec)
          Gets the partition.
 boolean isAlive(String catalogBaseUrl)
          This method checks if the catalog service is alive.
 boolean isTableExternal(String catalogUrl, String database, String tableName)
          Returns if the table is external or not.
 List<CatalogPartition> listPartitionsByFilter(String catalogUrl, String database, String tableName, String filter)
          List partitions by filter.
 boolean tableExists(String catalogUrl, String database, String tableName)
          This method checks if the given table exists in the catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HiveCatalogService

public HiveCatalogService()
Method Detail

get

public static org.apache.hcatalog.api.HCatClient get(org.apache.falcon.entity.v0.cluster.Cluster cluster)
                                              throws FalconException
Throws:
FalconException

get

public static org.apache.hcatalog.api.HCatClient get(String metastoreUrl)
                                              throws FalconException
Throws:
FalconException

isAlive

public boolean isAlive(String catalogBaseUrl)
                throws FalconException
Description copied from class: AbstractCatalogService
This method checks if the catalog service is alive.

Specified by:
isAlive in class AbstractCatalogService
Parameters:
catalogBaseUrl - url for the catalog service
Returns:
if the service was reachable
Throws:
FalconException - exception

tableExists

public boolean tableExists(String catalogUrl,
                           String database,
                           String tableName)
                    throws FalconException
Description copied from class: AbstractCatalogService
This method checks if the given table exists in the catalog.

Specified by:
tableExists in class AbstractCatalogService
Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
Returns:
if the table exists
Throws:
FalconException - exception

isTableExternal

public boolean isTableExternal(String catalogUrl,
                               String database,
                               String tableName)
                        throws FalconException
Description copied from class: AbstractCatalogService
Returns if the table is external or not.

Specified by:
isTableExternal in class AbstractCatalogService
Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
Returns:
true if external else false
Throws:
FalconException

listPartitionsByFilter

public List<CatalogPartition> listPartitionsByFilter(String catalogUrl,
                                                     String database,
                                                     String tableName,
                                                     String filter)
                                              throws FalconException
Description copied from class: AbstractCatalogService
List partitions by filter.

Specified by:
listPartitionsByFilter in class AbstractCatalogService
Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
filter - The filter string, for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can be done only on string partition keys.
Returns:
list of partitions
Throws:
FalconException

dropPartitions

public boolean dropPartitions(String catalogUrl,
                              String database,
                              String tableName,
                              Map<String,String> partitions)
                       throws FalconException
Description copied from class: AbstractCatalogService
Drops a given partition.

Specified by:
dropPartitions in class AbstractCatalogService
Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
partitions - list of partitions as Key=Value pairs
Returns:
if the partition was dropped
Throws:
FalconException

getPartition

public CatalogPartition getPartition(String catalogUrl,
                                     String database,
                                     String tableName,
                                     Map<String,String> partitionSpec)
                              throws FalconException
Description copied from class: AbstractCatalogService
Gets the partition.

Specified by:
getPartition in class AbstractCatalogService
Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
partitionSpec - The partition specification, {[col_name,value],[col_name2,value2]}. All partition-key-values must be specified.
Returns:
An instance of CatalogPartition.
Throws:
FalconException


Copyright © 2013-2014 Apache Software Foundation. All Rights Reserved.