hive创建表格以及加载数据

来源:互联网 发布:微软怎么下载软件 编辑:程序博客网 时间:2024/05/16 01:05

创建表格

drop table if exists DoubanComment;
create table DoubanComment(
commentItem              string,
userName                 string,
voteValue                string,
subjectId                string,
userId                  string,
voteCount                bigint,
commentTime              string,
commentText              string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t';

加载数据

几种常见的数据导入方式
(1)、从本地文件系统中导入数据到Hive表;

load data local inpath '/opt/zhu/data/doubanBook_Comments.txt' overwrite into table DoubanComment;
(2)、从HDFS上导入数据到Hive表;

load data inpath '/opt/zhu/data/doubanBook_Comments.txt' overwrite into table DoubanComment;


0 0
原创粉丝点击