二百八十、ClickHouse——用Kettle对DWD层补全的清洗数据进行记录

一、目的

在对DWD层清洗数据进行补全后,需要生成相应的补全记录,作为数据的标记

二、实施步骤

2.1 建表

复制代码
create  table  if not exists  hurys_jw.dwd_data_correction_record(
    data_type      Int32      comment '数据类型 1:转向比,2:统计,3:评价,4:区域,6:静态排队,7:动态排队',
    device_no      String     comment '设备编号',
    id             String     comment '唯一ID',
    create_time    DateTime   comment '创建时间',
    record_type    Int32      comment '记录类型 0:补全,1:修复',
    day            Date       comment '日期'
)
ENGINE = MergeTree
PARTITION BY day
PRIMARY KEY (day,id)
ORDER BY (day,id)
SETTINGS index_granularity = 8192;

2.2 SQL语句

复制代码
--1.2统计数据补全记录
select
       '2' data_type,
       t2.device_no,
       t2.id,
       t2.create_time,
       '0' record_type,
       cast(t2.day as String) day
from hurys_jw.dwd_statistics as t2
left join hurys_jw.ods_statistics as t3
on t3.device_no=t2.device_no and t3.create_time=t2.create_time and t3.lane_no=t2.lane_no
       and t3.section_no = t2.section_no and t3.coil_no=t2.coil_no
where t2.day='2024-12-16'  and  length(t3.device_no)=0
;

注意红色部分,由于DWD清洗表的device_no没有设置允许非空,因此不能使用 t3.device_no is null 作为条件

2.3 Kettle任务

2.3.1 newtime

2.3.2 替换NULL值

2.3.3 clickhouse输入

2.3.4 字段选择

2.3.5 clickhouse输出

2.3.6 Kettle任务运行

搞定!

相关推荐
QYR_Jodie20 分钟前
从科研投入与技术迭代驱动到稳增扩容:全球小角度X射线散射仪2025年0.7亿,2032年达0.85亿,2026-2032年CAGR3.0%
大数据·人工智能
蓝眸少年CY1 小时前
Hbase - 入门到实战
大数据·数据库·hbase
拾光向日葵2 小时前
南京林业大学2026年硕士研究生跨门类调剂政策详解
大数据·人工智能·物联网
财经资讯数据_灵砚智能2 小时前
基于全球经济类多源新闻的NLP情感分析与数据可视化(日间)2026年4月7日
大数据·人工智能·python·信息可视化·语言模型·自然语言处理·ai编程
大树882 小时前
【无标题】
大数据·运维·服务器·人工智能
Rabbit_QL3 小时前
【Git基础】03——Git 撤销与回退:改错了怎么办
大数据·git·elasticsearch
安科瑞小许3 小时前
35kV变电站的“智慧大脑”——综合自动化系统
大数据·网络·变电站·零碳园区
相九辞3 小时前
系统运维第1期:什么是系统运维?
大数据
tian_jiangnan4 小时前
Flink checkopint使用教程
大数据·flink
武子康4 小时前
大数据-262 实时数仓 - Canal 同步数据实战指南 实时统计
大数据·hadoop·后端