【发布时间】:2021-05-17 21:55:03
【问题描述】:
使用命令:
describe formatted my_table partition my_partition
我们能够在my_table 中列出包括分区my_partition 的hdfs 位置的元数据。但是我们如何才能得到 2 列的输出:
Partition | Location
哪个会列出my_table 中的所有分区及其hdfs 位置?
【问题讨论】:
-
你不能。显示 metadata 的命令(如
show或describe)不应用作 data 的源,然后可以使用 SQL 对其进行操作。 -
但是您可以使用 Java API 访问 Hive Metastore,参见。 stackoverflow.com/questions/33880050/… >> 每个
Partition都有自己的StorageDescriptor;注意没有Table方法可以访问自己的Partition描述符,你必须回到HiveMetastoreClient
标签: hive