Hive describe partitions to show partition url

2019-04-26 12:12发布

I know that there is

decribe formatted table_name;

that shows you the table format. Is there a way to get a more information about partitions apart from

show partitions table_name;

I saw that Hive language manual has this

DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name PARTITION partition_spec

I would like to view all the partitions along with the url in hdfs or s3 where the data is stored.

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-04-26 12:41
analyze table TABLENAME partition(the_partition) compute statistics nopass;

The above code gives you more info about the partitions (number of files, number of rows, total size), but doesn't give you exact location.

If you want exact location, you may want to create an external table.

查看更多
一夜七次
3楼-- · 2019-04-26 12:51

To show partitions:

show partitions table_name

To show where a partition is physically stored:

describe formatted dbname.tablename partition (name=value)

I don't know of a built-in way to create an output that is (partition, path) but you can build it using these two commands and some grep/awk or whatever.

查看更多
登录 后发表回答