将hive表导出为hdfs中的csv [英] exporting Hive table to csv in hdfs
问题描述
我知道在Hive中将表保存到csv(或其他文本文件)时存在分隔符的已知问题。所以我想知道你们是否可以帮我解决这个问题。
我有一个现有的表(表A),我想将它保存为csv格式为hdfs。从阅读其他答案,我相信我将不得不首先创建一个外部表(但我不确定整个外观如何)。
任何人都可以帮忙吗?
在hive shell中试试这个:
INSERT OVERWRITE LOCAL DIRECTORY'/ path / to / hive / csv'ROW FORMAT DELIMITED FIELDS TERMINATED BY','SELECT * FROM hivetablename;
将您的 / path /更改为/ csv
到您想要存储csv文件的位置。 hivetablename
到您的配置单元表格以csv格式存储。
I know there is a known issue with delimiters when saving a table to csv (or other text file) in Hive. So I'm wondering if you guys can help me get around that.
I have an existing table (Table A) and I would like to save it in csv format to hdfs. From reading other responses I believe I would have to first create an external table (but I'm not sure how the whole thing would look).
Can anyone help?
Try this in hive shell:
INSERT OVERWRITE LOCAL DIRECTORY '/path/to/hive/csv' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' SELECT * FROM hivetablename;
Change your /path/to/csv
to the location where you want to store csv file. hivetablename
to your hive table to be stored in csv format.
这篇关于将hive表导出为hdfs中的csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!