使用Java API从Hive获取表属性 [英] Get Table Properties out of Hive using Java API

查看:1195
本文介绍了使用Java API从Hive获取表属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用java中的metastore客户端来获取table data,name,owner和hdfs位置之类的表属性。我想我可以获取表格数据库和名称,但我无法弄清楚如何获取所有者和hdfs位置等内容。可能吗?我一直在搜索文档和互联网几个小时,现在没有骰子。

I'm trying to get table properties like table db, name, owner, and hdfs location out of the hive metastore using the metastore client in java. I think I can get the table databases and names okay, but I can't figure out how to grab things like owner and hdfs location. Is it possible? I've been searching the doc and internet for a couple hours now and no dice.

推荐答案

可能是这样的:

Could be something like that:

org.apache.hadoop.hive.metastore.api.Table table=..........;
org.apache.hadoop.hive.metastore.api.StorageDescriptor sd=table.getSd();
String loc=sd.getLocation();
String own=sd.getOwner();

https://hive.apache.org/javadocs/r0.11.0/api/org/apache/hadoop/hive/ metastore / api / Table.html
https://hive.apache.org/javadocs/r0.11.0/api/org/apache/hadoop/hive/metastore/api/StorageDescriptor.html

这篇关于使用Java API从Hive获取表属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆