2014-10-20 27 views

回答

0

您可以使用org.apache.hadoop.hive.metastore API或HCat API。这是一个使用hive.metastore的简单例子。除非你想加入Mapper/Reducer中的一些Hive分区,否则你必须在你的Pipeline开始之前或之前打电话。

HiveMetaStoreClient hmsc = new HiveMetaStoreClient(hiveConf) 
HiveMetaStoreClient hiveClient = getHiveMetastoreConnection(); 
List<Partition> partitions = hiveClient.listPartittions("default", "my_hive_table", 1000) 
for(Partition partition: partitions) { 
    System.out.println("HDFS data location of the partition: " + partition.getSd().getLocation()) 
} 

你需要的唯一的另一件事是出口蜂巢的conf目录:

export HIVE_CONF_DIR=/home/mmichalski/hive/conf