You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by mb...@apache.org on 2015/05/29 15:46:09 UTC

[5/6] flink git commit: [docs] Removed unnecessary Serializable from ExecutionEnvironment JavaDocs

[docs] Removed unnecessary Serializable from ExecutionEnvironment JavaDocs

Also did for StreamExecutionEnvironment


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

Branch: refs/heads/master
Commit: 2315c7c5935a703eee10eb9eabb75aa8490d1457
Parents: 120bd0f
Author: mbalassi <mb...@apache.org>
Authored: Sun May 24 17:51:21 2015 +0200
Committer: mbalassi <mb...@apache.org>
Committed: Fri May 29 15:08:32 2015 +0200

----------------------------------------------------------------------
 .../flink/api/java/ExecutionEnvironment.java    | 30 +--------
 .../environment/StreamExecutionEnvironment.java | 64 ++++++--------------
 2 files changed, 21 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/2315c7c5/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java b/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
index 9c76409..3a5b04f 100644
--- a/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
+++ b/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
@@ -19,7 +19,6 @@
 package org.apache.flink.api.java;
 
 import java.io.IOException;
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
@@ -600,9 +599,7 @@ public abstract class ExecutionEnvironment {
 	
 	/**
 	 * Creates a DataSet from the given non-empty collection. The type of the data set is that
-	 * of the elements in the collection. The elements need to be serializable (as defined by
-	 * {@link java.io.Serializable}), because the framework may move the elements into the cluster
-	 * if needed.
+	 * of the elements in the collection.
 	 * <p>
 	 * The framework will try and determine the exact type from the collection elements.
 	 * In case of generic elements, it may be necessary to manually supply the type information
@@ -632,13 +629,8 @@ public abstract class ExecutionEnvironment {
 	}
 	
 	/**
-	 * Creates a DataSet from the given non-empty collection. The type of the data set is that
-	 * of the elements in the collection. The elements need to be serializable (as defined by
-	 * {@link java.io.Serializable}), because the framework may move the elements into the cluster
-	 * if needed.
-	 * <p>
-	 * Note that this operation will result in a non-parallel data source, i.e. a data source with
-	 * a parallelism of one.
+	 * Creates a DataSet from the given non-empty collection. Note that this operation will result
+	 * in a non-parallel data source, i.e. a data source with a parallelism of one.
 	 * <p>
 	 * The returned DataSet is typed to the given TypeInformation.
 	 *  
@@ -663,9 +655,6 @@ public abstract class ExecutionEnvironment {
 	 * explicitly in the form of the type class (this is due to the fact that the Java compiler
 	 * erases the generic type information).
 	 * <p>
-	 * The iterator must be serializable (as defined in {@link java.io.Serializable}), because the
-	 * framework may move it to a remote environment, if needed.
-	 * <p>
 	 * Note that this operation will result in a non-parallel data source, i.e. a data source with
 	 * a parallelism of one.
 	 * 
@@ -686,9 +675,6 @@ public abstract class ExecutionEnvironment {
 	 * is generic. In that case, the type class (as given in {@link #fromCollection(Iterator, Class)}
 	 * does not supply all type information.
 	 * <p>
-	 * The iterator must be serializable (as defined in {@link java.io.Serializable}), because the
-	 * framework may move it to a remote environment, if needed.
-	 * <p>
 	 * Note that this operation will result in a non-parallel data source, i.e. a data source with
 	 * a parallelism of one.
 	 * 
@@ -699,10 +685,6 @@ public abstract class ExecutionEnvironment {
 	 * @see #fromCollection(Iterator, Class)
 	 */
 	public <X> DataSource<X> fromCollection(Iterator<X> data, TypeInformation<X> type) {
-		if (!(data instanceof Serializable)) {
-			throw new IllegalArgumentException("The iterator must be serializable.");
-		}
-		
 		return new DataSource<X>(this, new IteratorInputFormat<X>(data), type, Utils.getCallLocationName());
 	}
 	
@@ -710,8 +692,6 @@ public abstract class ExecutionEnvironment {
 	/**
 	 * Creates a new data set that contains the given elements. The elements must all be of the same type,
 	 * for example, all of the {@link String} or {@link Integer}. The sequence of elements must not be empty.
-	 * Furthermore, the elements must be serializable (as defined in {@link java.io.Serializable}, because the
-	 * execution environment may ship the elements into the cluster.
 	 * <p>
 	 * The framework will try and determine the exact type from the collection elements.
 	 * In case of generic elements, it may be necessary to manually supply the type information
@@ -738,8 +718,6 @@ public abstract class ExecutionEnvironment {
 	/**
 	 * Creates a new data set that contains elements in the iterator. The iterator is splittable, allowing the
 	 * framework to create a parallel data source that returns the elements in the iterator.
-	 * The iterator must be serializable (as defined in {@link java.io.Serializable}, because the
-	 * execution environment may ship the elements into the cluster.
 	 * <p>
 	 * Because the iterator will remain unmodified until the actual execution happens, the type of data
 	 * returned by the iterator must be given explicitly in the form of the type class (this is due to the
@@ -758,8 +736,6 @@ public abstract class ExecutionEnvironment {
 	/**
 	 * Creates a new data set that contains elements in the iterator. The iterator is splittable, allowing the
 	 * framework to create a parallel data source that returns the elements in the iterator.
-	 * The iterator must be serializable (as defined in {@link java.io.Serializable}, because the
-	 * execution environment may ship the elements into the cluster.
 	 * <p>
 	 * Because the iterator will remain unmodified until the actual execution happens, the type of data
 	 * returned by the iterator must be given explicitly in the form of the type information.

http://git-wip-us.apache.org/repos/asf/flink/blob/2315c7c5/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
----------------------------------------------------------------------
diff --git a/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java b/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
index 09a8788..8dd15bb 100644
--- a/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
+++ b/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
@@ -70,7 +70,6 @@ import org.apache.hadoop.mapreduce.Job;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.Serializable;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -438,15 +437,12 @@ public abstract class StreamExecutionEnvironment {
 
 	/**
 	 * Creates a new data stream that contains the given elements. The elements must all be of the same type, for
-	 * example, all of the {@link String} or {@link Integer}. The sequence of elements must not be empty. Furthermore,
-	 * the elements must be serializable (as defined in {@link java.io.Serializable}), because the execution
-	 * environment
-	 * may ship the elements into the cluster.
-	 * <p/>
+	 * example, all of the {@link String} or {@link Integer}.
+	 * <p>
 	 * The framework will try and determine the exact type from the elements. In case of generic elements, it may be
 	 * necessary to manually supply the type information via {@link #fromCollection(java.util.Collection,
 	 * org.apache.flink.api.common.typeinfo.TypeInformation)}.
-	 * <p/>
+	 * <p>
 	 * Note that this operation will result in a non-parallel data stream source, i.e. a data stream source with a
 	 * degree of parallelism one.
 	 *
@@ -471,15 +467,14 @@ public abstract class StreamExecutionEnvironment {
 
 	/**
 	 * Creates a data stream from the given non-empty collection. The type of the data stream is that of the
-	 * elements in
-	 * the collection. The elements need to be serializable (as defined by {@link java.io.Serializable}), because the
-	 * framework may move the elements into the cluster if needed.
-	 * <p/>
+	 * elements in the collection.
+	 *
+	 * <p>
 	 * The framework will try and determine the exact type from the collection elements. In case of generic
-	 * elements, it
-	 * may be necessary to manually supply the type information via {@link #fromCollection(java.util.Collection,
-	 * org.apache.flink.api.common.typeinfo.TypeInformation)}.
-	 * <p/>
+	 * elements, it may be necessary to manually supply the type information via
+	 * {@link #fromCollection(java.util.Collection, org.apache.flink.api.common.typeinfo.TypeInformation)}.
+	 * <p>
+	 *
 	 * Note that this operation will result in a non-parallel data stream source, i.e. a data stream source with a
 	 * degree of parallelism one.
 	 *
@@ -503,12 +498,8 @@ public abstract class StreamExecutionEnvironment {
 	}
 
 	/**
-	 * Creates a data stream from the given non-empty collection. The type of the data stream is the type given by
-	 * typeInfo. The elements need to be serializable (as defined by {@link java.io.Serializable}), because the
-	 * framework may move the elements into the cluster if needed.
-	 * <p/>
-	 * Note that this operation will result in a non-parallel data stream source, i.e. a data stream source with a
-	 * degree of parallelism one.
+	 * Creates a data stream from the given non-empty collection.Note that this operation will result in
+	 * a non-parallel data stream source, i.e. a data stream source with a degree of parallelism one.
 	 *
 	 * @param data
 	 * 		The collection of elements to create the data stream from
@@ -535,11 +526,7 @@ public abstract class StreamExecutionEnvironment {
 	 * Creates a data stream from the given iterator. Because the iterator will remain unmodified until the actual
 	 * execution happens, the type of data returned by the iterator must be given explicitly in the form of the type
 	 * class (this is due to the fact that the Java compiler erases the generic type information).
-	 * <p/>
-	 * The iterator must be serializable (as defined in {@link java.io.Serializable}), because the framework may
-	 * move it
-	 * to a remote environment, if needed.
-	 * <p/>
+	 * <p>
 	 * Note that this operation will result in a non-parallel data stream source, i.e. a data stream source with a
 	 * degree of parallelism of one.
 	 *
@@ -562,11 +549,7 @@ public abstract class StreamExecutionEnvironment {
 	 * information. This method is useful for cases where the type is generic. In that case, the type class (as
 	 * given in
 	 * {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information.
-	 * <p/>
-	 * The iterator must be serializable (as defined in {@link java.io.Serializable}), because the framework may
-	 * move it
-	 * to a remote environment, if needed.
-	 * <p/>
+	 * <p>
 	 * Note that this operation will result in a non-parallel data stream source, i.e. a data stream source with a
 	 * degree of parallelism one.
 	 *
@@ -581,9 +564,6 @@ public abstract class StreamExecutionEnvironment {
 	public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT>
 			typeInfo) {
 		Preconditions.checkNotNull(data, "The iterator must not be null");
-		if (!(data instanceof Serializable)) {
-			throw new IllegalArgumentException("The iterator must be serializable.");
-		}
 
 		SourceFunction<OUT> function = new FromIteratorFunction<OUT>(data);
 		return addSource(function, "Collection Source").returns(typeInfo);
@@ -597,12 +577,8 @@ public abstract class StreamExecutionEnvironment {
 
 	/**
 	 * Creates a new data stream that contains elements in the iterator. The iterator is splittable, allowing the
-	 * framework to create a parallel data stream source that returns the elements in the iterator. The iterator
-	 * must be
-	 * serializable (as defined in {@link java.io.Serializable}, because the execution environment may ship the
-	 * elements
-	 * into the cluster.
-	 * <p/>
+	 * framework to create a parallel data stream source that returns the elements in the iterator.
+	 * <p>
 	 * Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the
 	 * iterator must be given explicitly in the form of the type class (this is due to the fact that the Java compiler
 	 * erases the generic type information).
@@ -621,12 +597,8 @@ public abstract class StreamExecutionEnvironment {
 
 	/**
 	 * Creates a new data stream that contains elements in the iterator. The iterator is splittable, allowing the
-	 * framework to create a parallel data stream source that returns the elements in the iterator. The iterator
-	 * must be
-	 * serializable (as defined in {@link java.io.Serializable}, because the execution environment may ship the
-	 * elements
-	 * into the cluster.
-	 * <p/>
+	 * framework to create a parallel data stream source that returns the elements in the iterator.
+	 * <p>
 	 * Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the
 	 * iterator must be given explicitly in the form of the type information. This method is useful for cases where the
 	 * type is generic. In that case, the type class (as given in {@link #fromParallelCollection(org.apache.flink.util.SplittableIterator,