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

时间:2019-05-07 01:24:37

标签: hive hiveql parquet

我已将配置单元表保存为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;

1 个答案:

答案 0 :(得分:1)

第1步:创建具有相似列的text_table

第2步:将数据加载到text_table

第3步:将数据从text_table插入parquet_table。

  insert into Parquet_table as select * from text_table;