Java Hive 描述分区以显示分区 url
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22056402/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hive describe partitions to show partition url
提问by viper
I know that there is
我知道有
DESCRIBE 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
我看到 Hive 语言手册有这个
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.
我想查看所有分区以及存储数据的 hdfs 或 s3 中的 url。
回答by JJFord3
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.
如果您想要确切的位置,您可能需要创建一个外部表。
回答by Jon Watte
To show partitions:
显示分区:
show partitions table_name
show partitions table_name
To show where a partition is physically stored:
要显示分区的物理存储位置:
describe formatted dbname.tablename partition (name=value)
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.
我不知道创建输出(分区、路径)的内置方法,但您可以使用这两个命令和一些 grep/awk 或其他命令来构建它。