--使用者畫像--客戶屬性資訊表
drop table if exists gdm.gdm_user_portrait_basic;
CREATE EXTERNAL TABLE gdm.gdm_user_portrait_basic(
user_id bigint ,--使用者ID
user_name string ,--使用者登入名
user_sex string ,--性别
user_birthday string ,--生日
user_age bigint ,--年齡
constellation string ,--星座
big_area_name string ,--大區域
province string ,--省份
city string ,--城市
city_level string ,--城市等級
hex_mail string ,--郵箱
op_mail string ,--郵箱營運商
hex_phone string ,--加密手機
fore_phone string ,--手機前幾位
op_phone string ,--手機營運商
add_time string ,--注冊時間
login_ip string ,--登陸IP位址
login_source string ,--登入來源
request_user string ,--邀請人
total_mark bigint ,--會員積分
used_mark bigint ,--已使用積分
level_name string ,--會員等級名稱
blacklist bigint ,--使用者黑名單
is_married bigint ,--婚姻狀況
education string ,--學曆
monthly_income bigint ,--月收入
profession string ,--職業
sex_model bigint ,--性别模型
is_pregnant_woman bigint ,--是否孕婦
is_have_children bigint ,-- 是否有小孩
children_sex_rate double ,--孩子性别機率
children_age_rate double ,--孩子年齡機率
is_have_car bigint ,--是否有車
potential_car_user_rate double ,--潛在汽車使用者機率
phone_brand string ,--使用手機品牌
phone_brand_level string ,--使用手機品牌檔次
phone_cnt bigint ,--使用多少種不同的手機
change_phone_rate bigint ,--更換手機頻率(月份)
majie_flag string ,--馬甲标志
majie_account_cnt bigint ,--馬甲賬号數量
loyal_model bigint ,--使用者忠誠度
shopping_type_model bigint ,--使用者購物類型
figure_model bigint ,--身材
stature_model bigint ,--身高
dw_date timestamp
)
partitioned by
(dt string)
;
#***************************************************************
#檔案名稱: gdm_user_portrait_basic.sql
#
#****************************************************************
insert overwrite table gdm.gdm_user_portrait_basic partition(dt = '2015-01-01')
select
t.user_id bigint ,--使用者ID
t.user_name string ,--使用者登入名
t.user_sex string ,--性别
t.user_birthday string ,--生日
t.user_age bigint ,--年齡
t.constellation string ,--星座
t.big_area_name string ,--大區域
t.province string ,--省份
t.city tring ,--城市
t.city_level string ,--城市等級
t.hex_mail string ,--郵箱
t.op_mail string ,--郵箱營運商
t.hex_phone string ,--加密手機
t.fore_phone string ,--手機前幾位
t.op_phone string ,--手機營運商
t.add_time string ,--注冊時間
t.login_ip string ,--登陸IP位址
t.login_source string ,--登入來源
t.request_user string ,--邀請人
t.total_mark bigint ,--會員積分
t.used_mark bigint ,--已使用積分
t.level_name string ,--會員等級名稱
t.blacklist bigint ,--使用者黑名單
t.is_married bigint ,--婚姻狀況
t.education string ,--學曆
t.monthly_income bigint ,--月收入
t.profession string ,--職業
null sex_model bigint ,--性别模型
null is_pregnant_woman bigint ,--是否孕婦
null is_have_children bigint ,-- 是否有小孩
null children_sex_rate double ,--孩子性别機率
null children_age_rate double ,--孩子年齡機率
null is_have_car bigint ,--是否有車
null potential_car_user_rate double ,--潛在汽車使用者機率
null phone_brand string ,--使用手機品牌
null phone_brand_level string ,--使用手機品牌檔次
null phone_cnt bigint ,--使用多少種不同的手機
null change_phone_rate bigint ,--更換手機頻率(月份)
null majie_flag string ,--馬甲标志
null majie_account_cnt bigint ,--馬甲賬号數量
null loyal_model bigint ,--使用者忠誠度
null shopping_type_model bigint ,--使用者購物類型
null figure_model bigint ,--身材
null stature_model bigint ,--身高
from_unixtime(unix_timestamp()) dw_date
from (select * from fdm.fdm_user_wide where dt ='2015-01-01') t
;