Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

hadoop - How to convert HDFS file to csv or tsv.

I have a use case where I have to convert HDFS file format to csv or tsv. I know a way where we can create hive table on top of hdfs file format and than store the data as required format. But for this, I required information of data(like column name to create table). Is there any other way using hive or something else which convert any file format of hdfs to csv or tsv?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First of all.. to convert the data to CSV or TSV you will be needing your data as structured please check for this once.
The way which you specified to convert the data using Hive is one of the options.
Other option would be to use spark. -- Here you have to read the data in structured format and then while saving you have to convert to CSV. Please refer to the following link for more explanation:

How to export data from Spark SQL to CSV

You can use python as well to convert the data to CSV.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...