1. 在hvie关联hbase创建外部表时报错:
hive> CREATE EXTERNAL table dmp_user_register(key string,address string,gpsx string,gpsy string,loginid string,nettype string,runmode string,apkversion string,channel string,city string,coolacount string,
> cpbversion string,hardware string,imei string,imsi string,logintime string,meid string,netip string,online string,operator string,phonenum string,pkgname string,product string,province string,registertime string,sdkver string,
> sn string,state string,vercode string)
> STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
> WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:addr,cf:gpsx,cf:gpsy,cf:id,cf:nt,cf:rm,cf:av,cf:ch,cf:ct,cf:cy,cf:cpb,cf:hdv,cf:imei,cf:imsi,cf:lgt,
> cf:meid,cf:ip,cf:ol,cf:op,cf:ph,cf:pkg,cf:md,cf:prv,cf:rt,cf:sdk,cf:sn,cf:st,cf:vc")
> TBLPROPERTIES ("hbase.table.name" = "dmp_user_register");
FAILED: Error in metadata: MetaException(message:Column Family
cf is not defined in hbase table dmp_user_register)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
解决:问题在hbase.columns.mapping子句中出现了空格和换行等不可见字符,本例中就是出现了换行符造成的。把hbase.columns.mapping后面的字段映射放在一行无空格等特殊字符即可。