如何将HDFS文件转换为csv或tsv. [英] How to convert HDFS file to csv or tsv.

查看:194
本文介绍了如何将HDFS文件转换为csv或tsv.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用例,其中我必须将HDFS文件格式转换为csv或tsv.我知道一种方法,我们可以在hdfs文件格式之上创建配置单元表,然后将数据存储为所需格式.但是为此,我需要数据信息(例如创建表的列名).还有其他使用蜂巢的方法或其他将hdfs的任何文件格式转换为csv或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?

推荐答案

首先..要将数据转换为CSV或TSV,您将需要结构化的数据,请检查一次.
您指定的使用Hive转换数据的方式是选项之一.
另一种选择是使用火花.-在这里,您必须以结构化格式读取数据,然后在保存时必须转换为CSV.请参考以下链接以获取更多说明:

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:

如何将数据从Spark SQL导出到CSV

您也可以使用python将数据转换为CSV.

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

这篇关于如何将HDFS文件转换为csv或tsv.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆