RocMarshal commented on a change in pull request #18641:
URL: https://github.com/apache/flink/pull/18641#discussion_r813971115



##########
File path: docs/content.zh/docs/connectors/datastream/formats/avro.md
##########
@@ -39,23 +40,23 @@ The serialization framework of Flink is able to handle 
classes generated from Av
 </dependency>
 ```
 
-In order to read data from an Avro file, you have to specify an 
`AvroInputFormat`.
+如果读取 Avro 文件数据,你必须指定 `AvroInputFormat`。
 
-**Example**:
+**示例**:
 
 ```java
 AvroInputFormat<User> users = new AvroInputFormat<User>(in, User.class);
 DataStream<User> usersDS = env.createInput(users);
 ```
 
-Note that `User` is a POJO generated by Avro. Flink also allows to perform 
string-based key selection of these POJOs. For example:
+注意,`User` 是一个通过 Avro schema生成的 POJO 类。Flink 还允许选择 POJO 中字符串类型的键。例如:
 
 ```java
 usersDS.keyBy("name")
 ```
 
 
-Note that using the `GenericData.Record` type is possible with Flink, but not 
recommended. Since the record contains the full schema, its very data intensive 
and thus probably slow to use.
+注意,在 Flink 中可能会使用 `GenericData.Record` 类型,但是不推荐使用。由于该类型的记录中包含了完整的 
schema,导致数据非常密集,使用起来可能很慢。

Review comment:
       `可能会`->`可以`  
   
   `由于`->`因为` ?
   

##########
File path: docs/content.zh/docs/connectors/datastream/formats/avro.md
##########
@@ -39,23 +40,23 @@ The serialization framework of Flink is able to handle 
classes generated from Av
 </dependency>
 ```
 
-In order to read data from an Avro file, you have to specify an 
`AvroInputFormat`.
+如果读取 Avro 文件数据,你必须指定 `AvroInputFormat`。
 
-**Example**:
+**示例**:
 
 ```java
 AvroInputFormat<User> users = new AvroInputFormat<User>(in, User.class);
 DataStream<User> usersDS = env.createInput(users);
 ```
 
-Note that `User` is a POJO generated by Avro. Flink also allows to perform 
string-based key selection of these POJOs. For example:
+注意,`User` 是一个通过 Avro schema生成的 POJO 类。Flink 还允许选择 POJO 中字符串类型的键。例如:
 
 ```java
 usersDS.keyBy("name")
 ```
 
 
-Note that using the `GenericData.Record` type is possible with Flink, but not 
recommended. Since the record contains the full schema, its very data intensive 
and thus probably slow to use.
+注意,在 Flink 中可能会使用 `GenericData.Record` 类型,但是不推荐使用。由于该类型的记录中包含了完整的 
schema,导致数据非常密集,使用起来可能很慢。
 
-Flink's POJO field selection also works with POJOs generated from Avro. 
However, the usage is only possible if the field types are written correctly to 
the generated class. If a field is of type `Object` you can not use the field 
as a join or grouping key.
-Specifying a field in Avro like this `{"name": "type_double_test", "type": 
"double"},` works fine, however specifying it as a UNION-type with only one 
field (`{"name": "type_double_test", "type": ["double"]},`) will generate a 
field of type `Object`. Note that specifying nullable types (`{"name": 
"type_double_test", "type": ["null", "double"]},`) is possible!
+Flink 中在 Avro schema 生成的 POJO 类上也可以进行 POJO 
字段选择。因此,只有在生成的类中正确写入字段类型时,才可以使用字段选择。如果一个字段类型是 `Object` 类型,你不可以选择该字段进行 join 或者 
group by 操作。
+在 Avro 中类似 `{"name": "type_double_test", "type": "double"},` 这样指定字段是可行的,但是类似 
(`{"name": "type_double_test", "type": ["double"]},`) 这样指定字段,字段类型就会生成为 `Object` 
类型。注意,类似 (`{"name": "type_double_test", "type": ["null", "double"]},`) 这样指定 
nullable 类型字段,也是有可能的!

Review comment:
       ```
   在 Avro 中如 `{"name": "type_double_test", "type": "double"},` 这样指定字段是可行的,但是如 
(`{"name": "type_double_test", "type": ["double"]},`) 这样指定包含一个字段的复合类型就会生成 
`Object` 类型的字段。注意,如 (`{"name": "type_double_test", "type": ["null", 
"double"]},`) 这样指定 nullable 类型字段也是可能产生 `Object` 类型的!
   ```

##########
File path: docs/content.zh/docs/connectors/datastream/formats/avro.md
##########
@@ -39,23 +40,23 @@ The serialization framework of Flink is able to handle 
classes generated from Av
 </dependency>
 ```
 
-In order to read data from an Avro file, you have to specify an 
`AvroInputFormat`.
+如果读取 Avro 文件数据,你必须指定 `AvroInputFormat`。
 
-**Example**:
+**示例**:
 
 ```java
 AvroInputFormat<User> users = new AvroInputFormat<User>(in, User.class);
 DataStream<User> usersDS = env.createInput(users);
 ```
 
-Note that `User` is a POJO generated by Avro. Flink also allows to perform 
string-based key selection of these POJOs. For example:
+注意,`User` 是一个通过 Avro schema生成的 POJO 类。Flink 还允许选择 POJO 中字符串类型的键。例如:
 
 ```java
 usersDS.keyBy("name")
 ```
 
 
-Note that using the `GenericData.Record` type is possible with Flink, but not 
recommended. Since the record contains the full schema, its very data intensive 
and thus probably slow to use.
+注意,在 Flink 中可能会使用 `GenericData.Record` 类型,但是不推荐使用。由于该类型的记录中包含了完整的 
schema,导致数据非常密集,使用起来可能很慢。
 
-Flink's POJO field selection also works with POJOs generated from Avro. 
However, the usage is only possible if the field types are written correctly to 
the generated class. If a field is of type `Object` you can not use the field 
as a join or grouping key.
-Specifying a field in Avro like this `{"name": "type_double_test", "type": 
"double"},` works fine, however specifying it as a UNION-type with only one 
field (`{"name": "type_double_test", "type": ["double"]},`) will generate a 
field of type `Object`. Note that specifying nullable types (`{"name": 
"type_double_test", "type": ["null", "double"]},`) is possible!
+Flink 中在 Avro schema 生成的 POJO 类上也可以进行 POJO 
字段选择。因此,只有在生成的类中正确写入字段类型时,才可以使用字段选择。如果一个字段类型是 `Object` 类型,你不可以选择该字段进行 join 或者 
group by 操作。

Review comment:
       ```suggestion
   Flink 的 POJO 字段选择也适用于从 Avro schema 生成的 POJO 类。但是,只有将字段类型正确写入生成的类时,才能使用。如果字段是 
`Object` 类型,则不能将该字段用作 join 键或 grouping 键。
   ```




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to