flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject [04/11] git commit: [FLINK-1148] Create a writeAsCsv(path, writemode) variant
Date Fri, 17 Oct 2014 14:52:31 GMT
[FLINK-1148] Create a writeAsCsv(path, writemode) variant


Project: http://git-wip-us.apache.org/repos/asf/incubator-flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-flink/commit/da54db69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-flink/tree/da54db69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-flink/diff/da54db69

Branch: refs/heads/release-0.7
Commit: da54db698cc349040f967578cbb835f6e83f8e25
Parents: 9310703
Author: Stephan Ewen <sewen@apache.org>
Authored: Mon Oct 13 21:36:10 2014 +0200
Committer: Robert Metzger <rmetzger@apache.org>
Committed: Fri Oct 17 16:48:55 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/flink/api/java/DataSet.java | 37 ++++++++++++++------
 1 file changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/da54db69/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
----------------------------------------------------------------------
diff --git a/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java b/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
index dd8c4ba..bfaf612 100644
--- a/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
+++ b/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
@@ -554,9 +554,8 @@ public abstract class DataSet<T> {
 	 *   {@link DataSet DataSets} on key equality and provides multiple ways to combine 
 	 *   joining elements into one DataSet.</br>
 	 * 
-	 * This method returns a {@link JoinOperatorSets} on which 
-	 *   {@link JoinOperatorSets#where()} needs to be called to define the join key of the first

-	 *   joining (i.e., this) DataSet.
+	 * This method returns a {@link JoinOperatorSets} on which one of the {@code where} methods
+	 * can be called to define the join key of the first joining (i.e., this) DataSet.
 	 *  
 	 * @param other The other DataSet with which this DataSet is joined.
 	 * @return A JoinOperatorSets to continue the definition of the Join transformation.
@@ -576,7 +575,7 @@ public abstract class DataSet<T> {
 	 * This method also gives the hint to the optimizer that the second DataSet to join is much
 	 *   smaller than the first one.</br>
 	 * This method returns a {@link JoinOperatorSets} on which 
-	 *   {@link JoinOperatorSets#where()} needs to be called to define the join key of the first

+	 *   {@link JoinOperatorSets#where(String...)} needs to be called to define the join key
of the first 
 	 *   joining (i.e., this) DataSet.
 	 *  
 	 * @param other The other DataSet with which this DataSet is joined.
@@ -596,9 +595,8 @@ public abstract class DataSet<T> {
 	 *   joining elements into one DataSet.</br>
 	 * This method also gives the hint to the optimizer that the second DataSet to join is much
 	 *   larger than the first one.</br>
-	 * This method returns a {@link JoinOperatorSets JoinOperatorSet} on which 
-	 *   {@link JoinOperatorSets#where()} needs to be called to define the join key of the first

-	 *   joining (i.e., this) DataSet.
+	 * This method returns a {@link JoinOperatorSets} on which one of the {@code where} methods
+	 * can be called to define the join key of the first joining (i.e., this) DataSet.
 	 *  
 	 * @param other The other DataSet with which this DataSet is joined.
 	 * @return A JoinOperatorSet to continue the definition of the Join transformation.
@@ -623,9 +621,8 @@ public abstract class DataSet<T> {
 	 *   is called with an empty group for the non-existing group.</br>
 	 * The CoGroupFunction can iterate over the elements of both groups and return any number

 	 *   of elements including none.</br>
-	 * This method returns a {@link CoGroupOperatorSets} on which 
-	 *   {@link CoGroupOperatorSets#where()} needs to be called to define the grouping key of
the first 
-	 *   (i.e., this) DataSet.
+	 * This method returns a {@link JoinOperatorSets} on which one of the {@code where} methods
+	 * can be called to define the join key of the first joining (i.e., this) DataSet.
 	 * 
 	 * @param other The other DataSet of the CoGroup transformation.
 	 * @return A CoGroupOperatorSets to continue the definition of the CoGroup transformation.
@@ -1003,6 +1000,24 @@ public abstract class DataSet<T> {
 	}
 	
 	/**
+	 * Writes a {@link Tuple} DataSet as a CSV file to the specified location.<br/>
+	 * <b>Note: Only a Tuple DataSet can written as a CSV file.</b><br/>
+	 * For each Tuple field the result of {@link Object#toString()} is written.
+	 * Tuple fields are separated by the default field delimiter {@code "comma" (,)}.<br/>
+	 * Tuples are are separated by the newline character ({@code \n}).
+	 * 
+	 * @param filePath The path pointing to the location the CSV file is written to.
+	 * @param writeMode The behavior regarding existing files. Options are NO_OVERWRITE and
OVERWRITE.
+	 * @return The DataSink that writes the DataSet.
+	 * 
+	 * @see Tuple
+	 * @see CsvOutputFormat
+	 */
+	public DataSink<T> writeAsCsv(String filePath, WriteMode writeMode) {
+		return internalWriteAsCsv(new Path(filePath),CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER,
writeMode);
+	}
+	
+	/**
 	 * Writes a {@link Tuple} DataSet as a CSV file to the specified location with the specified
field and line delimiters.<br/>
 	 * <b>Note: Only a Tuple DataSet can written as a CSV file.</b><br/>
 	 * For each Tuple field the result of {@link Object#toString()} is written.
@@ -1026,7 +1041,7 @@ public abstract class DataSet<T> {
 	 * @param filePath The path pointing to the location the CSV file is written to.
 	 * @param rowDelimiter The row delimiter to separate Tuples.
 	 * @param fieldDelimiter The field delimiter to separate Tuple fields.
-	 * @param writeMode Control the behavior for existing files. Options are NO_OVERWRITE and
OVERWRITE.
+	 * @param writeMode The behavior regarding existing files. Options are NO_OVERWRITE and
OVERWRITE.
 	 * 
 	 * @see Tuple
 	 * @see CsvOutputFormat


Mime
View raw message