无法在cli中查看配置单元表数据(以Parquet文件格式存储)

olhwl3o2  于 2021-06-24  发布在  Hive
关注(0)|答案(1)|浏览(389)

我已将配置单元表保存为Parquet格式,并成功地将本地数据加载到其中。在执行 select 对表的操作我得到以下错误:

Failed with exception java.io.IOException:java.lang.RuntimeException: hdfs://localhost.localdomain:9000/user/hive/warehouse/practice.db/studentam/studarray is not a Parquet file. expected magic number at tail [80, 65, 82, 49] but found [48, 48, 54, 10]
Time taken: 0.434 seconds

create table studentAM(id int,name string,subject array<string>,mark map<string,int>,year int) row format delimited fields terminated by ',' collection items terminated by '#' map keys terminated by '$' lines terminated by '\n' stored as parquet;

file content:

1,subhash,math#eng#science,math$67#eng$60#science$85,2006
2,kundan,geo#social#pol,geo$79#social$70#pol$81,2007
3,sakesh,eng#math,eng$89#math$75,2006

load data local inpath 'studarray' into table studentam;
h4cxqtbf

h4cxqtbf1#

步骤1:创建具有类似列的文本表
步骤2:将数据加载到文本表中
步骤3:将数据从文本表格插入Parquet表格。

insert into Parquet_table as select * from text_table;

相关问题