退货表指标统计
参考代码:
–dw层创建fact_order_refunds表
drop table if exists
itcast_dw
.fact_order_refunds
;
create tableitcast_dw
.fact_order_refunds
(
id bigint,
orderId bigint,
goodsId bigint,
refundTo bigint,
refundReson bigint,
refundOtherReson string,
backMoney double,
refundTradeNo string,
refundRemark string,
refundTime string,
shopRejectReason string,
refundStatus bigint,
createTime string
)
partitioned by (dt string)
STORED AS PARQUET;
–从ods抽取数据到dw层中的fact_order_refunds
INSERT OVERWRITE TABLE
itcast_dw
.fact_order_refunds
PARTITION (dt=‘20190908’)
SELECT
id
,orderId
,goodsId
,refundTo
,refundReson
,refundOtherReson
,backMoney
,refundTradeNo
,refundRemark
,refundTime
,shopRejectReason
,refundStatus
,createTime
FROMitcast_ods
.itcast_order_refunds
WHERE dt=‘20190908’ ;
– 退货表指标统计
drop table if exists
itcast_ads
.tmp_user_refund_measure
;
create tableitc