十一、Flink进阶--Time深度解析

本文详细介绍了Apache Flink中处理时间的概念,包括Processing Time、Event Time和Ingestion Time。重点讨论了Event Time和Watermark的工作原理,如何在数据源中设置时间特征,以及Watermark的生成、传播和处理。同时,提到了在Table API和SQL中使用时间特性的注意事项。
摘要由CSDN通过智能技术生成

1. 概述

Flink在流处理程序中支持不同的时间概念。
在这里插入图片描述
首先需要理解三种time的含义:

  • Processing time: Processing time refers to the system time of the machine that is executing the respective operation. 处理事件时的时间,处理简单,结果不确定
  • Event time: Event time is the time that each individual event occurred on its producing device. 事件产生的时间,处理复杂,结果确定可以重现
  • Ingestion time: Ingestion time is the time that events enter Flink. 事件进入Flink的时间

1.1设置一个时间特征

首先定义你的流处理程序是已哪一种时间为标志的。

final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

env.setStreamTimeCharacteristic(TimeCharacteristic.ProcessingTime);

// env.setStreamTimeCharacteristic(TimeCharacteristic.IngestionTime);
// env.setStreamTimeCharacteristic(TimeCharacteristic.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值