(5)3.4DWD層5

3.4DWD層
對ODS層數據進行判空過濾。對商品分類表進行維度退化(降維)。
3.4.1 創建訂單表

hive (gmall)>
drop table if exists dwd_order_info;
create external table dwd_order_info (
id string COMMENT ‘’,
total_amount decimal(10,2) COMMENT ‘’,
order_status string COMMENT ’ 1234 5’,
user_id string COMMENT ‘id’,
payment_way string COMMENT ‘’,
out_trade_no string COMMENT ‘’,
create_time string COMMENT ‘’,
operate_time string COMMENT ‘’
)
PARTITIONED BY (dt string)
stored as parquet
location ‘/warehouse/gmall/dwd/dwd_order_info/’
tblproperties (“parquet.compression”=“snappy”)
;
3.4.2創建訂單詳情表

hive (gmall)>
drop table if exists dwd_order_detail;
create external table dwd_order_detail(
id string COMMENT ‘’,
order_id decimal(10,2) COMMENT ‘’,
user_id string COMMENT ‘id’,
sku_id string COMMENT ‘id’,
sku_name string COMMENT ‘’,
order_price string COMMENT ‘’,
sku_num string COMMENT ‘’,
create_time string COMMENT ‘’
)
PARTITIONED BY (dt string)
stored as parquet
location ‘/warehouse/gmall/dwd/dwd_order_detail/’
tblproperties (“parquet.compression”=“snappy”)
;
3.4.3創建用戶表

hive (gmall)>
drop table if exists dwd_user_info;
create external table dwd_user_info(
id string COMMENT ‘id’,
name string COMMENT ‘’,
birthday string COMMENT ‘’,
gender string COMMENT ‘’,
email string COMMENT ‘’,
user_level string COMMENT ‘’,
create_time string COMMENT ‘’
)
PARTITIONED BY (dt string)
stored as parquet
location ‘/warehouse/gmall/dwd/dwd_user_info/’
tblproperties (“parquet.compression”=“snappy”)
;
3.4.4創建支付流水錶

hive (gmall)>
drop table if exists dwd_payment_info;
create external table dwd_payment_info(
id bigint COMMENT ‘’,
out_trade_no string COMMENT ‘’,
order_id string COMMENT ‘’,
user_id string COMMENT ‘’,
alipay_trade_no string COMMENT ‘’,
total_amount decimal(16,2) COMMENT ‘’,
subject string COMMENT ‘’,
payment_type string COMMENT ‘’,
payment_time string COMMENT ‘’
)
PARTITIONED BY (dt string)
stored as parquet
location ‘/warehouse/gmall/dwd/dwd_payment_info/’
tblproperties (“parquet.compression”=“snappy”)
;
3.4.5創建商品表(增加分類)

hive (gmall)>
drop table if exists dwd_sku_info;
create external table dwd_sku_info(
id string COMMENT ‘skuId’,
spu_id string COMMENT ‘spuid’,
price decimal(10,2) COMMENT ‘’,
sku_name string COMMENT ‘’,
sku_desc string COMMENT ‘’,
weight string COMMENT ‘’,
tm_id string COMMENT ‘id’,
category3_id string COMMENT ‘1id’,
category2_id string COMMENT ‘2id’,
category1_id string COMMENT ‘3id’,
category3_name string COMMENT ‘3’,
category2_name string COMMENT ‘2’,
category1_name string COMMENT ‘1’,
create_time string COMMENT ‘’
)
PARTITIONED BY (dt string)
stored as parquet
location ‘/warehouse/gmall/dwd/dwd_sku_info/’
tblproperties (“parquet.compression”=“snappy”)
;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章