This is an automated email from the ASF dual-hosted git repository. jbonofre pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push: new a80ae25 [BEAM-8540] Fix CSVSink example in FileIO docs new d7b2c0e Merge pull request #9964 from jklukas/csvsink-fix a80ae25 is described below commit a80ae25386225a62906cf1fe43f2a4c8d3784065 Author: Jeff Klukas <j...@klukas.net> AuthorDate: Fri Nov 1 09:41:07 2019 -0400 [BEAM-8540] Fix CSVSink example in FileIO docs The existing example refers to a nonexistent interface and has several syntax errors. --- .../java/core/src/main/java/org/apache/beam/sdk/io/FileIO.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileIO.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileIO.java index 3339508..3785911 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileIO.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileIO.java @@ -245,7 +245,7 @@ import org.slf4j.LoggerFactory; * <h3>Example: Writing CSV files</h3> * * <pre>{@code - * class CSVSink implements FileSink<List<String>> { + * class CSVSink implements FileIO.Sink<List<String>> { * private String header; * private PrintWriter writer; * @@ -262,7 +262,7 @@ import org.slf4j.LoggerFactory; * writer.println(Joiner.on(",").join(element)); * } * - * public void finish() throws IOException { + * public void flush() throws IOException { * writer.flush(); * } * } @@ -270,13 +270,13 @@ import org.slf4j.LoggerFactory; * PCollection<BankTransaction> transactions = ...; * // Convert transactions to strings before writing them to the CSV sink. * transactions.apply(MapElements - * .into(lists(strings())) + * .into(TypeDescriptors.lists(TypeDescriptors.strings())) * .via(tx -> Arrays.asList(tx.getUser(), tx.getAmount()))) * .apply(FileIO.<List<String>>write() - * .via(new CSVSink(Arrays.asList("user", "amount")) + * .via(new CSVSink(Arrays.asList("user", "amount"))) * .to(".../path/to/") * .withPrefix("transactions") - * .withSuffix(".csv") + * .withSuffix(".csv")); * }</pre> * * <h3>Example: Writing CSV files to different directories and with different headers</h3>