flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] sunjincheng121 commented on a change in pull request #6805: [FLINK-10156][table] Deprecate Table.writeToSink()
Date Thu, 11 Oct 2018 01:27:14 GMT
sunjincheng121 commented on a change in pull request #6805: [FLINK-10156][table] Deprecate
Table.writeToSink()
URL: https://github.com/apache/flink/pull/6805#discussion_r224289223
 
 

 ##########
 File path: docs/dev/table/connect.md
 ##########
 @@ -1047,30 +1047,42 @@ The sink only supports append-only streaming tables. It cannot be
used to emit a
 <div data-lang="java" markdown="1">
 {% highlight java %}
 
-Table table = ...
-
-table.writeToSink(
-  new CsvTableSink(
+CsvTableSink sink = new CsvTableSink(
     path,                  // output path 
     "|",                   // optional: delimit files by '|'
     1,                     // optional: write to a single file
-    WriteMode.OVERWRITE)); // optional: override existing files
+    WriteMode.OVERWRITE);  // optional: override existing files
+
+tableEnv.registerTableSink(
+  "csvOutputTable",
+  sink,
+  // specify table schema
+  new String[]{"f0", "f1"},
+  new TypeInformation[]{Types.STRING, Types.INT});
 
+Table table = ...
+table.insertInto("csvOutputTable");
 {% endhighlight %}
 </div>
 
 <div data-lang="scala" markdown="1">
 {% highlight scala %}
 
-val table: Table = ???
-
-table.writeToSink(
-  new CsvTableSink(
+val sink: CsvTableSink = new CsvTableSink(
     path,                             // output path 
     fieldDelim = "|",                 // optional: delimit files by '|'
     numFiles = 1,                     // optional: write to a single file
-    writeMode = WriteMode.OVERWRITE)) // optional: override existing files
+    writeMode = WriteMode.OVERWRITE), // optional: override existing files
 
 Review comment:
   remove ","

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message