导入数据忽略首行字段名称:

create external table highschool(
geographic_area string,
city string,
percent_completed_hs string
)
row format delimited fields terminated by ','
stored as textfile 
location '/iii/HighSchool'
tblproperties("skip.header.line.count"="1")

HBase映射Hive配置:

create external table student(
stu_id int,
stu_name string,
stu_age int,
stu_sex string,
stu_birth string
)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
//注意:映射顺序与建表字段顺序一定要保持一致!!!
with serdeproperties("hbase.columns.mapping"=":key,info:name,info:age,base:sex,base:birth")
tblproperties("hbase.table.name"="students")
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐