shuai-xu commented on a change in pull request #11168: [FLINK-16140] [docs-zh] Translate Event Processing (CEP) page into Chinese URL: https://github.com/apache/flink/pull/11168#discussion_r387438680
########## File path: docs/dev/libs/cep.zh.md ########## @@ -1651,44 +1607,42 @@ val lateData: DataStream[String] = result.getSideOutput(lateDataOutputTag) </div> </div> -### Time context +### 时间上下文 -In [PatternProcessFunction](#selecting-from-patterns) as well as in [IterativeCondition](#conditions) user has access to a context -that implements `TimeContext` as follows: +在[PatternProcessFunction](#从模式中选取)中,用户可以和[IterativeCondition](#条件)中 +一样按照下面的方法使用实现了`TimeContext`的上下文: {% highlight java %} /** - * Enables access to time related characteristics such as current processing time or timestamp of - * currently processed element. Used in {@link PatternProcessFunction} and - * {@link org.apache.flink.cep.pattern.conditions.IterativeCondition} + * 支持获取事件属性比如当前处理事件或当前正处理的事件的时间。 + * 用在{@link PatternProcessFunction}和{@link org.apache.flink.cep.pattern.conditions.IterativeCondition}中 */ @PublicEvolving public interface TimeContext { /** - * Timestamp of the element currently being processed. + * 当前正处理的事件的时间戳。 * - * <p>In case of {@link org.apache.flink.streaming.api.TimeCharacteristic#ProcessingTime} this - * will be set to the time when event entered the cep operator. + * <p>如果是{@link org.apache.flink.streaming.api.TimeCharacteristic#ProcessingTime},这个值会被设置为事件进入CEP算子的时间。 */ long timestamp(); - /** Returns the current processing time. */ + /** 返回当前的处理时间。 */ long currentProcessingTime(); } {% endhighlight %} -This context gives user access to time characteristics of processed events (incoming records in case of `IterativeCondition` and matches in case of `PatternProcessFunction`). -Call to `TimeContext#currentProcessingTime` always gives you the value of current processing time and this call should be preferred to e.g. calling `System.currentTimeMillis()`. +这个上下文让用户可以获取处理的事件(在`IterativeCondition`时候是进来的记录,在`PatternProcessFunction`是匹配的结果)的时间属性。 +调用`TimeContext#currentProcessingTime`总是返回当前的处理时间,而且尽量去调用这个函数而不是调用其它的比如说`System.currentTimeMillis()`。 -In case of `TimeContext#timestamp()` the returned value is equal to assigned timestamp in case of `EventTime`. In `ProcessingTime` this will equal to the point of time when said event entered -cep operator (or when the match was generated in case of `PatternProcessFunction`). This means that the value will be consistent across multiple calls to that method. +使用`EventTime`时,`TimeContext#timestamp()`返回的值等于分配的时间戳。 +使用`ProcessingTime`是,这个值等于事件进入CEP算子的时间点(在`PatternProcessFunction`中是匹配产生的时间)。 Review comment: done ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services