我有一个.orc文件,有没有办法将其转换为.csv文件? 还是有其他方法可以读取此文件中的表?
Hive具有本机ORC
支持,因此您可以通过Hive直接读取它。
插图:
(比如说,文件名为myfile.orc
(
上传文件到HDFS
hadoop fs -mkdir hdfs:///my_table_orc_file
hadoop fs -put myfile.orc hdfs:///my_table_orc_file
在其上创建 Hive 表
(更新列定义以匹配数据(
CREATE EXTERNAL TABLE `my_table_orc`(
`col1` string,
`col2` string)
STORED AS ORC
LOCATION
'hdfs:///my_table_orc_file';
查询它
select * from my_table_orc;
您可以使用以下命令读取ORC文件的内容
hive --orcfiledump -d <path_of_orc_file_in_hdfs>
它将以 json 形式返回内容。