先在HDFS创建目录
hdfs dfs -mkdir -p /user/hive/warehouse/test.db/hdfsParquet/
在CK创建表
create table hdfsParquet(id Int16,name String)
engine=HDFS('hdfs://node1:8020/user/hive/warehouse/test.db/hdfsParquet/a.Parquet','Parquet');
创建CK表成功
insert into hdfsParquet values(1,'zhangsan');
写入成功,
到HDFS上查看一下
hdfs dfs -text /user/hive/warehouse/test.db/hdfsParquet/a.Parquet
image.png
看到数据啦
创建HIVE表关联刚刚的文件
drop table if exists hdfsParquet;
create external table if not exists hdfsParquet (
id int ,
name string
)
stored as parquet
location '/user/hive/warehouse/test.db/hdfsParquet';
执行查询语句
select * from hdfsParquet;
image.png
数据出来啦!!
网友评论