This is an automated email from the ASF dual-hosted git repository.

echauchot pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit b7154f2347beb735bc1cbbd523389ebc738e00cf
Author: Etienne Chauchot <echauc...@apache.org>
AuthorDate: Fri May 5 15:26:30 2023 +0200

    [FLINK-31749][hotfix][doc] Fix HadoopInputFormat example code for DataStream
---
 .../docs/connectors/datastream/formats/hadoop.md     | 20 ++++++++++----------
 .../docs/connectors/datastream/formats/hadoop.md     | 12 ++++++------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/docs/content.zh/docs/connectors/datastream/formats/hadoop.md 
b/docs/content.zh/docs/connectors/datastream/formats/hadoop.md
index 0be4e18d75f..4eb9a45a304 100644
--- a/docs/content.zh/docs/connectors/datastream/formats/hadoop.md
+++ b/docs/content.zh/docs/connectors/datastream/formats/hadoop.md
@@ -68,13 +68,13 @@ under the License.
 
 ```java
 StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+  KeyValueTextInputFormat textInputFormat = new KeyValueTextInputFormat();
 
-DataStream<Tuple2<LongWritable, Text>> input =
-    env.createInput(HadoopInputs.readHadoopFile(new TextInputFormat(),
-                        LongWritable.class, Text.class, textPath));
+  DataStream<Tuple2<Text, Text>> input = 
env.createInput(HadoopInputs.readHadoopFile(
+  textInputFormat, Text.class, Text.class, textPath));
 
-// 对数据进行一些处理。
-[...]
+  // Do something with the data.
+  [...]
 ```
 
 {{< /tab >}}
@@ -82,13 +82,13 @@ DataStream<Tuple2<LongWritable, Text>> input =
 
 ```scala
 val env = StreamExecutionEnvironment.getExecutionEnvironment
-
-val input: DataStream[(LongWritable, Text)] =
+val textInputFormat = new KeyValueTextInputFormat
+val input: DataStream[(Text, Text)] =
   env.createInput(HadoopInputs.readHadoopFile(
-                    new TextInputFormat, classOf[LongWritable], classOf[Text], 
textPath))
+    textInputFormat, classOf[Text], classOf[Text], textPath))
 
-// 对数据进行一些处理。
-[...]
+    // Do something with the data.
+    [...]
 ```
 
 {{< /tab >}}
diff --git a/docs/content/docs/connectors/datastream/formats/hadoop.md 
b/docs/content/docs/connectors/datastream/formats/hadoop.md
index 86637f3cf5a..663fbe60283 100644
--- a/docs/content/docs/connectors/datastream/formats/hadoop.md
+++ b/docs/content/docs/connectors/datastream/formats/hadoop.md
@@ -77,10 +77,10 @@ The following example shows how to use Hadoop's 
`TextInputFormat`.
 
 ```java
 StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+KeyValueTextInputFormat textInputFormat = new KeyValueTextInputFormat();
 
-DataStream<Tuple2<LongWritable, Text>> input =
-    env.createInput(HadoopInputs.readHadoopFile(new TextInputFormat(),
-                        LongWritable.class, Text.class, textPath));
+DataStream<Tuple2<Text, Text>> input = 
env.createInput(HadoopInputs.readHadoopFile(
+  textInputFormat, Text.class, Text.class, textPath));
 
 // Do something with the data.
 [...]
@@ -91,10 +91,10 @@ DataStream<Tuple2<LongWritable, Text>> input =
 
 ```scala
 val env = StreamExecutionEnvironment.getExecutionEnvironment
-
-val input: DataStream[(LongWritable, Text)] =
+val textInputFormat = new KeyValueTextInputFormat
+val input: DataStream[(Text, Text)] =
   env.createInput(HadoopInputs.readHadoopFile(
-                    new TextInputFormat, classOf[LongWritable], classOf[Text], 
textPath))
+    textInputFormat, classOf[Text], classOf[Text], textPath))
 
 // Do something with the data.
 [...]

Reply via email to