非分区表
-- 示例1:
use temp;
drop table tmp_cuiwei_main_recommend;
create table IF NOT EXISTS tmp_cuiwei_main_recommend(
sml_sa_id int,
sml_set_time int,
sml_cancel_time int
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
';
-- local 表示数据文件在linux文件系统。如果不加local,则需要将文件上传到HDFS
load data local inpath '/data/home/gongzi/main_recommend.csv' into table temp.tmp_cuiwei_main_recommend;
select
sml_sa_id,
-- 加上##号的目的是看字段与数据有没有对应上
"##",
sml_set_time,
"##",
sml_cancel_time
from temp.tmp_cuiwei_main_recommend limit 30;
-- 示例2:
use temp;
drop table main_goods_yongyuan;
create table IF NOT EXISTS main_goods_yongyuan(
a string,
b string,
c string,
d string,
e int
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
';
-- local 表示数据文件在linux文件系统。如果不加local,则需要将文件上传到HDFS
load data local inpath '/tmp/xiaoming.txt' into table temp.main_goods_yongyuan;
Blog:hive 非分区表 导入csv数据