二百八十、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任务运行

搞定!

相关推荐
狮歌~资深攻城狮1 小时前
HBase性能优化秘籍:让数据处理飞起来
大数据·hbase
Elastic 中国社区官方博客2 小时前
Elasticsearch Open Inference API 增加了对 Jina AI 嵌入和 Rerank 模型的支持
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索·jina
workflower3 小时前
Prompt Engineering的重要性
大数据·人工智能·设计模式·prompt·软件工程·需求分析·ai编程
API_technology4 小时前
电商搜索API的Elasticsearch优化策略
大数据·elasticsearch·搜索引擎
黄雪超5 小时前
大数据SQL调优专题——引擎优化
大数据·数据库·sql
The god of big data5 小时前
MapReduce 第二部:深入分析与实践
大数据·mapreduce
G***技6 小时前
杰和科技GAM-AI视觉识别管理系统,让AI走进零售营销
大数据·人工智能·系统架构
天天爱吃肉82187 小时前
碳化硅(SiC)功率器件:新能源汽车的“心脏”革命与技术突围
大数据·人工智能
Java资深爱好者7 小时前
在Spark中,如何使用DataFrame进行高效的数据处理
大数据·分布式·spark
跨境卫士小树9 小时前
店铺矩阵崩塌前夜:跨境多账号运营的3个生死线
大数据·线性代数·矩阵