创建目标表
create table student(
name string comment ’ xingming’,
sex string comment ’ sex’
)
partitioned by (etl_date String)
row format delimited fields terminated by ‘|’ stored as parquet;
创建临时表
要求:分隔符一致
create table student_tmp(
name string comment ’ xingming’,
sex string comment ’ sex’
)
partitioned by (etl_date String)
row format delimited fields terminated by ‘|’ ;
导数进临时表
load data local inpath ‘/cib/a.txt’ into table student_tmp partition(etl_date=‘20200202’);
从临时表查数插入到目标表
insert into table student partition(etl_date=‘20200202’)
select
*
from student_tmp;