KarmaGYZ commented on a change in pull request #9749: [FLINK-14115][docs-zh]
Translate DataStream Code Walkthrough to Chinese
URL: https://github.com/apache/flink/pull/9749#discussion_r327465031
##########
File path: docs/getting-started/walkthroughs/datastream_api.zh.md
##########
@@ -490,13 +491,13 @@ class FraudDetector extends KeyedProcessFunction[Long,
Transaction, Alert] {
</div>
</div>
-`ValueState` is a wrapper class, similar to `AtomicReference` or `AtomicLong`
in the Java standard library.
-It provides three methods for interacting with its contents; `update` sets the
state, `value` gets the current value, and `clear` deletes its contents.
-If the state for a particular key is empty, such as at the beginning of an
application or after calling `ValueState#clear`, then `ValueState#value` will
return `null`.
-Modifications to the object returned by `ValueState#value` are not guaranteed
to be recognized by the system, and so all changes must be performed with
`ValueState#update`.
-Otherwise, fault tolerance is managed automatically by Flink under the hood,
and so you can interact with it like with any standard variable.
+`ValueState` 是一个包装类,类似于 Java 标准库里边的 `AtomicReference` 和 `AtomicLong`。
+它提供了三个用于交互的方法。`update` 用于更新状态,`value` 用于获取状态值,还有 `clear` 用于清空状态。
+如果一个 key 还没有状态,例如当程序刚启动或者调用过 `ValueState#clear` 方法时,`ValueState#value` 将会返回
`null`。
+如果需要更新状态,需要调用 `ValueState#update` 方法,直接更改 `ValueState#value` 的返回值可能不会被系统识别。
+容错处理将在 Flink 后台自动管理,你可以像与常规变量那样与状态变量进行交互。
-Below, you can see an example of how you can use a flag state to track
potential fraudulent transactions.
+下边的示例,说明了如何使用标记状态来追踪可能的欺诈交易行为。
<div class="codetabs" markdown="1">
<div data-lang="java" markdown="1">
Review comment:
We may remove the useless indentation in zh version.
----------------------------------------------------------------
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]
With regards,
Apache Git Services