Hive数据导入初体验

  |   0 评论   |   0 浏览

背景

将外部数据,写入Hive中。

初体验

load file

创建表

CREATE TABLE if not exists abeffect.note (
    request_id string comment '日志id',
    date string comment '日志日期',
    query string comment '用户query',
)
PARTITIONED by (dayno string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;

将文件上传至HDFS

hadoop fs -put file.txt hdfs://bucket/tmp/abeffect/note/20220117/1.txt

通过hive导入

进入 beeline.sh

load data inpath 'hdfs://bucket/tmp/abeffect/note/20220117/1.txt' into table abeffect.note partition (dayno ='2022-01-17')

参考