操作步骤
1.建立外表
CREATE external TABLE t_rk_baseinfo_5kwexternal
(
ROW_ID STRING, SYNC_SIGN STRING, SYNC_ERROR_DESC STRING, OperateType STRING, SYNC_Date STRING, XiaQuCode STRING, Name STRING, NameEN STRING, NameUsed STRING, Sex STRING, Nation STRING, Birthday STRING, BirthPlace STRING, Age STRING, Native STRING, Nationality STRING, IdcardType STRING, Idcard STRING, IdcardBeginDate STRING, IdcardEndDate STRING, Political STRING, MaritalStatus STRING, Faith STRING, MilitaryService STRING, Height STRING, Weight STRING, BloodType STRING, Mobile STRING, Telephone STRING, RegionAddress STRING, Address STRING, PostCode STRING, EMail STRING, Health STRING, FamliyDiseaseHis STRING, IdDeath STRING, DeathDate STRING, Type STRING, PersonGuid STRING, HabCode STRING, AgeArea STRING, HouseholdType STRING, Education STRING, baidulat STRING, baidulng STRING)
row format delimited fields terminated by ‘\t’;
;
2.文件抽取至HDFS
3.创建事务表
clustered by (ROW_ID) into 3 buckets
stored as orc TBLPROPERTIES (‘transactional’=’true’);
备用:LOAD DATA INPATH ‘/path/to/local/files’ into table t_rk_baseinfo;
4.hdfs到外表
5.外表到事务表
insert into 事务表 select * from 外表;