1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| CREATE EXTERNAL TABLE loan.dws_loan_user_base_info_d ( user_id bigint COMMENT '用户ID', first_channel string COMMENT '一级渠道', second_channel string COMMENT '二级渠道', first_loan_apply_time string COMMENT '首次借款申请时间', first_loan_apply_succ_time string COMMENT '首次借款成功申请时间', first_loan_succ_time string COMMENT '首次放款成功放款时间', recent_loan_apply_time string COMMENT '最近一次借款申请提交时间', recent_loan_audit_time string COMMENT '最近一次借款申请审核时间', recent_loan_audit_status string COMMENT '最近一次借款审核状态(含自动审核拒绝永久、拒绝30天) 审核中-自动审核,审核中-人工审核,自动审核通过,审核通过,拒绝放款-可立即重申 永不放款,拒绝放款-可N天重申', total_loan_cnt int COMMENT '申请借款总单数', total_succ_loan_cnt int COMMENT '放款成功总单数', use_coupon_apply_amt string COMMENT '使用优惠券总申请金额', use_coupon_apply_cnt int COMMENT '使用优惠券总单数', recent_act_day string COMMENT '最近一次还款时间', recent_settle_time string COMMENT '最近一次结清时间', ) COMMENT '用户借款表' PARTITIONED BY ( `dt` string) row format delimited fields terminated by ',' STORED AS TEXTFILE location 'file:/root/wangqi/spark-warehouse/loan.db/dws_user_base_loan_info_d';
CREATE EXTERNAL TABLE loan.dwd_credit_apply_info_d ( credit_id bigint COMMENT '贷前订单ID', user_id bigint COMMENT '用户ID', user_name string COMMENT '姓名', apply_status string COMMENT '贷前授信状态', credit_amount string COMMENT '贷前授信金额', apply_time string COMMENT '订单申请时间', audit_time string COMMENT '订单通过时间', credit_risk_info string COMMENT '贷前风控返回结果', ) COMMENT '贷前订单表' PARTITIONED BY ( `dt` string) row format delimited fields terminated by ',' STORED AS TEXTFILE location 'file:/root/wangqi/spark-warehouse/loan.db/dwd_credit_apply_info_d';
CREATE EXTERNAL TABLE loan.dwd_loan_info_core_d ( 订单金额:10000 已还:2000 剩余:8000 loan_id bigint COMMENT '借款ID', credit_id bigint COMMENT '申请借款ID', user_id bigint COMMENT '用户ID', interest_rate string COMMENT '借款利率', due_amount string COMMENT '应还本金', act_amount string COMMENT '实还本金', repay_type string COMMENT '还款方式', loan_amount string COMMENT '借款金额', create_time string COMMENT '借款时间' ) COMMENT '贷中信息表' PARTITIONED BY ( `dt` string) row format delimited fields terminated by ',' STORED AS TEXTFILE location 'file:/root/wangqi/spark-warehouse/loan.db/dwd_loan_info_core_d';
CREATE EXTERNAL TABLE loan.dwd_repay_plan_d ( repay_plan_id bigint COMMENT '还款计划ID', loan_id bigint COMMENT '借款ID', user_id bigint COMMENT '用户ID', loan_rates string COMMENT '利率 borrow_interest 利息利率, service_interest 服务费利率, overdue_borrow_interest 逾期利息利率, overdue_service_interest 逾期服务费利率,penalty_interest 违约金利率', due_amount string COMMENT '应还本金', due_day string COMMENT '应还日期', act_day string COMMENT '实还日期', act_amount string COMMENT '实还本金', repay_type string COMMENT '还款方式', due_service_interest string COMMENT '应还服务费', act_service_interest string COMMENT '实还服务费', settle_time string COMMENT '结清时间' ) COMMENT '贷后信息表' PARTITIONED BY ( `dt` string) row format delimited fields terminated by ',' STORED AS TEXTFILE location 'file:/root/wangqi/spark-warehouse/loan.db/dwd_repay_plan_d';
loan_id repay_plan_id 001. 001_01 001. 001_02 ... 001. 001_10
CREATE EXTERNAL TABLE loan.dwd_use_coupon_d ( user_id bigint COMMENT '用户ID', coupon_id bigint COMMENT '优惠券ID', coupon_apply_amt string COMMENT '使用优惠券总申请金额', flag int COMMENT '是否使用', ) COMMENT '优惠券表' PARTITIONED BY ( `dt` string) row format delimited fields terminated by ',' STORED AS TEXTFILE location 'file:/root/wangqi/spark-warehouse/loan.db/dwd_use_coupon_d';
|