val conf = new Configuration()
conf.set("hive.metastore.uris","thrift://hdppmgt02.domain.com:9083")
val hiveConf = new HiveConf(conf, classOf[HiveConf])
val metastoreClient = new HiveMetaStoreClient(hiveConf)
metastoreClient.getTable(db, tbl).getPartitionKeys.foreach(x=>println("Keys : "+x))
3条答案
按热度按时间cpjpxq1n1#
通过scala/javaapi,我们可以访问hivemetastore并获得分区列名org.apache.hadoop.hive.metastore.hivemetastoreclient
csbfibhn2#
1qczuiv03#
可能不是最好的方法,但还有一种方法是使用descripe命令
创建表:
命令:
输出:
你可以根据需要改进它。
另一个我不得不探索的选项是通过查询元存储库表来获取表的分区列信息。