一、分析
针对ods层表中的数据进行清洗,参考数据清洗规则,按照实际情况对数据进行清洗。
由于数据库中的数据都是比较规整的,其实可以直接迁移到dwd层,不过为了以防万一,还是对ods层的数据进行过滤,主要过滤表中的id字段为null的数据,在关系型数据库中表中的id字段都是主键,肯定是不为Null的,我们在这里进行判断主要是为了避免数据在采集过程中出现问题。
二、构建dwd层
1、dwd_user
(1)源表
ods_user
(2)建表语句
create external table if not exists dwd_mall.dwd_user(
user_id bigint,
user_name string,
user_gender tinyint,
user_birthday string,
e_mail string,
mobile string,
register_time string,
is_blacklist tinyint
)partitioned by(dt string)
row format delimited
fields terminated by '\t'
location 'hdfs://bigdata01:9000/data/dwd/user/';