use cmpay_credit;
-- Create external table for USER in HBase
drop table if exists ex_user;
create external table if not exists ex_user(
rowid string,
account_level string,
name string,
boss_brand string,
credit_level string,
birthday string,
cmpay_id string,
fst_consume_day string,
bind_card_type string,
score_identity string,
is_validate string,
is_black_list string,
lastest_active_date string,
score_history_credit string,
register_date string,
score_time string,
user_id string,
admiss_date string,
score_behavior string,
score_social_cycle string,
sex string,
score_performance string,
is_real string,
mobile_no string,
bind_card_amount string,
cur_year_fst_login_day string,
score_total string
) ROW FORMAT SERDE 'org.apache.hadoop.hive.hbase.HBaseSerDe'
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES(
"hbase.columns.mapping"=":key, cf:account_level, cf:name, cf:boss_brand,
cf:credit_level, cf:birthday, cf:cmpay_id, cf:fst_consume_day,
cf:bind_card_type, cf:score_identity, cf:is_validate, cf:is_black_lisT,
cf:lastest_active_date, cf:score_history_credit, cf:register_date,
cf:score_time, cf:user_id, cf:admiss_date, cf:score_behavior,
cf:score_social_cycle, cf:sex, cf:score_performance, cf:is_real, cf:mobile_no,
cf:bind_card_amount, cf:cur_year_fst_login_day, cf:score_total")
TBLPROPERTIES( "hbase.table.name"="USER");
-- export records of specified fields from ex_user
insert overwrite local directory '/tmp/user_score'
row format delimited fields terminated by ',' select mobile_no, score_behavior,
score_history_credit, score_identity, score_performance, score_social_cycle,
score_total from ex_user;
注意一点
rowid string,
对应key