klion26 commented on a change in pull request #12442:
URL: https://github.com/apache/flink/pull/12442#discussion_r439924453
##########
File path: docs/dev/event_time.zh.md
##########
@@ -89,30 +76,12 @@
env.set_stream_time_characteristic(TimeCharacteristic.ProcessingTime)
</div>
</div>
-值得注意的是,如果要用*事件时间*作为时间特征运行此示例,程序需要使用那些给数据直接定义事件时间并能自己发出水印的源,或者程序必须在收到源发出的事件流之后注入“时间戳分配器和水印生成器”,这些功能描述了访问事件时间戳的方法,以及事件流呈现的乱序程度。
-
-可以参考[生成时间戳/水印]({{ site.baseurl
}}/zh/dev/event_timestamps_watermarks.html),了解如何使用 Flink DataStream API
分配时间戳和生成水印。
-
-{% top %}
-
-## 空闲源
-
-当前,对于纯粹的事件时间水印生成器,如果没有要处理的事件,水印是不会生成并下发的,无法推进。这意味着在输入数据存在间隙的情况下,事件时间将不会继续前进,例如无法触发窗口算子,因此现有窗口将无法生成任何输出数据。
-
-为了避免这种情况,可以使用周期性水印分配器,这种分配器不仅基于事件时间戳,还会在没有事件的时候产生新水印。
比如在长时间没有观测到事件流入时,可以采用系统当前时间来生成水印。
-
-可使用 `SourceFunction.SourceContext#markAsTemporarilyIdle` 标记源是空闲的,详情可参考这个方法以及
`StreamStatus` 类的 Javadoc 。
-
-## 调试水印
-
-请参考[调试窗口&事件时间]({{ site.baseurl
}}/zh/monitoring/debugging_event_time.html)了解运行阶段的水印调试。
-
-## 算子如何处理水印
-
-通常,要求算子在将给定水印转发到下游之前,必须对这个水印进行完全处理。例如,`WindowOperator`
首先评估应该触发哪些窗口,然后只有在产生了由水印触发的所有输出之后,水印本身才会被发送到下游。换句话说,由水印而触发的所有元素都将在水印之前被发出。
+值得注意的是,为了能够使用*事件时间*作为时间特征运行此示例,程序需要使用那些能给数据直接定义事件时间并自己发出水印的源,或者程序必须在收到源发出的事件流之后注入“时间戳分配器和水印生成器”,这些功能描述了访问事件时间戳的方法,以及事件流呈现的乱序程度。
-这个规则同样适用于 `TwoInputStreamOperator`。但是,在这种情况下,算子的当前水印被定义为两个输入的最小值。
+## 接下来看什么?
-该行为具体由
`OneInputStreamOperator#processWatermark`、`TwoInputStreamOperator#processWatermark1`
和 `TwoInputStreamOperator#processWatermark2`方法定义。
+* [生成水印]({% link dev/event_timestamps_watermarks.zh.md%}):描述了在写可感知事件时间的 Flink
应用程序时,如何定义时间戳分配器和水印生成器。
+* [内置水印生成器]({% link dev/event_timestamp_extractors.zh.md %}):概述了 Flink
自带的水印生成器。
+* [调试窗口&事件时间]({{
site.baseurl}}/zh/monitoring/debugging_event_time.html):描述了在可感知事件时间的 Flink
应用程序里,如何调试水印和时间戳。
Review comment:
这里的连接修改为和上面的一样吧 ({% link monitoring/debugging_event_time.zh.md %}
这个修改后可以在本地验证下是否符合预期
本地验证方法为
- 执行 `./docs/dockers/run.sh/`
- 执行 ./build.sh -p
- 打开 localhost:4000 找到翻译的文档,然后校对
##########
File path: docs/dev/event_time.zh.md
##########
@@ -24,40 +24,22 @@ specific language governing permissions and limitations
under the License.
-->
-In this section you will learn about writing time-aware Flink programs. Please
-take a look at [Timely Stream Processing]({% link
-concepts/timely-stream-processing.zh.md %}) to learn about the concepts behind
-timely stream processing.
+本节你将学到如何写可感知时间变化的 Flink 程序,可以先看看[实时流处理]({% link
concepts/timely-stream-processing.zh.md %})了解相关概念。
-For information about how to use time in Flink programs refer to
-[windowing]({% link dev/stream/operators/windows.zh.md %}) and
-[ProcessFunction]({% link
-dev/stream/operators/process_function.zh.md %}).
+想了解如何在 Flink 程序中使用时间特性,请参阅[窗口]({% link dev/stream/operators/windows.zh.md
%})和[处理函数]({% link dev/stream/operators/process_function.zh.md %})。
-* toc
-{:toc}
+使用*事件时间*进行流处理的先决条件是设置合适的*时间特性*,该设置定义了数据流的行为方式(例如,是否分配时间戳),以及窗口算子使用哪种时间概念,例如
`KeyedStream.timeWindow(Time.seconds(30))` 。
-## Setting a Time Characteristic
-
-The first part of a Flink DataStream program usually sets the base *time
characteristic*. That setting
-defines how data stream sources behave (for example, whether they will assign
timestamps), and what notion of
-time should be used by window operations like
`KeyedStream.timeWindow(Time.seconds(30))`.
-
-The following example shows a Flink program that aggregates events in hourly
time windows. The behavior of the
-windows adapts with the time characteristic.
+你可以调用 `StreamExecutionEnvironment.setStreamTimeCharacteristic()` 设置时间特性:
<div class="codetabs" markdown="1">
<div data-lang="java" markdown="1">
{% highlight java %}
final StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();
-env.setStreamTimeCharacteristic(TimeCharacteristic.ProcessingTime);
Review comment:
这里修改看上去是为了 和 master 对齐用的。
这个 review 起来会稍微麻烦一点,现在看 diff 是和实际效果有出入的。
下次有这种情况,建议分为多个 commit(一个 commit 单独同步英文文档,一个 commit 用于翻译,方便 review)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]