YngwieWang commented on a change in pull request #9299: [FLINK-13405][docs-zh]
Translate "Basic API Concepts" page into Chinese
URL: https://github.com/apache/flink/pull/9299#discussion_r317586492
##########
File path: docs/dev/api_concepts.zh.md
##########
@@ -379,45 +302,45 @@ public static class ComplexNestedClass {
}
{% endhighlight %}
-These are valid field expressions for the example code above:
+这些字段表达式对于以上代码示例都是合法的:
-- `"count"`: The count field in the `WC` class.
+- `"count"`:`WC` 类的 count 字段。
-- `"complex"`: Recursively selects all fields of the field complex of POJO
type `ComplexNestedClass`.
+- `"complex"`:递归选择 POJO 类型 `ComplexNestedClass` 的 complex 字段的全部字段。
-- `"complex.word.f2"`: Selects the last field of the nested `Tuple3`.
+- `"complex.word.f2"`:选择嵌套 `Tuple3` 类型的最后一个字段。
-- `"complex.hadoopCitizen"`: Selects the Hadoop `IntWritable` type.
+- `"complex.hadoopCitizen"`:选择 hadoop 的 `IntWritable` 类型。
</div>
<div data-lang="scala" markdown="1">
-In the example below, we have a `WC` POJO with two fields "word" and "count".
To group by the field `word`, we just pass its name to the `keyBy()` function.
+下例中,我们有一个包含“word”和“count”两个字段的 POJO:`WC`。要用 `word` 字段分组,我们只需要把它的名字传给 `keyBy()`
函数即可。
{% highlight java %}
-// some ordinary POJO (Plain old Java Object)
+// 普通的 POJO(简单的 Java 对象)
class WC(var word: String, var count: Int) {
def this() { this("", 0L) }
}
val words: DataStream[WC] = // [...]
-val wordCounts = words.keyBy("word").window(/*window specification*/)
+val wordCounts = words.keyBy("word").window(/*指定窗口*/)
-// or, as a case class, which is less typing
+// 或者,代码少一点的 case class
case class WC(word: String, count: Int)
val words: DataStream[WC] = // [...]
-val wordCounts = words.keyBy("word").window(/*window specification*/)
+val wordCounts = words.keyBy("word").window(/*指定窗口*/)
{% endhighlight %}
-**Field Expression Syntax**:
+**字段表达式语法**:
-- Select POJO fields by their field name. For example `"user"` refers to the
"user" field of a POJO type.
+- 根据字段名称选择 POJO 的字段。例如 `“user”` 就是指 POJO 类型的“user”字段。
-- Select Tuple fields by their 1-offset field name or 0-offset field index.
For example `"_1"` and `"5"` refer to the first and sixth field of a Scala
Tuple type, respectively.
+- 根据字段名称或 0 开始的字段索引选择 Tuple 的字段。例如 `“f0”` 和 `“5”` 分别指 Java Tuple 类型的第一个和第五个字段。
Review comment:
👍 java 那里原文就是 java,不知道是否需要修改。
----------------------------------------------------------------
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