flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [2/3] incubator-flink git commit: [FLINK-1259] [apis] Added comments to interface and docs that filters must not mutate date elements.
Date Tue, 06 Jan 2015 15:50:12 GMT
[FLINK-1259] [apis] Added comments to interface and docs that filters must not mutate date
elements.


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

Branch: refs/heads/master
Commit: e71ee0b7953f7b061f3541c63650651a471cb6b7
Parents: 875c6aa
Author: Stephan Ewen <sewen@apache.org>
Authored: Tue Jan 6 15:01:26 2015 +0100
Committer: Stephan Ewen <sewen@apache.org>
Committed: Tue Jan 6 15:56:03 2015 +0100

----------------------------------------------------------------------
 docs/dataset_transformations.md                         |  3 +++
 docs/programming_guide.md                               | 10 ++++++++--
 .../flink/api/common/functions/FilterFunction.java      | 12 ++++++++++--
 3 files changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/e71ee0b7/docs/dataset_transformations.md
----------------------------------------------------------------------
diff --git a/docs/dataset_transformations.md b/docs/dataset_transformations.md
index 94933d0..f17c000 100644
--- a/docs/dataset_transformations.md
+++ b/docs/dataset_transformations.md
@@ -175,6 +175,9 @@ val naturalNumbers = intNumbers.filter { _ > 0 }
 </div>
 </div>
 
+**IMPORTANT:** The system assumes that the function does not modify the elements on which
the predicate is applied. Violating this assumption
+can lead to incorrect results.
+
 ### Project (Tuple DataSets only) (Java API Only)
 
 The Project transformation removes or moves Tuple fields of a Tuple DataSet.

http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/e71ee0b7/docs/programming_guide.md
----------------------------------------------------------------------
diff --git a/docs/programming_guide.md b/docs/programming_guide.md
index 5a8614a..dcf1095 100644
--- a/docs/programming_guide.md
+++ b/docs/programming_guide.md
@@ -494,7 +494,11 @@ data.mapPartition(new MapPartitionFunction<String, Long>() {
       <td><strong>Filter</strong></td>
       <td>
         <p>Evaluates a boolean function for each element and retains those for which
the function
-        returns true.</p>
+        returns true.<br/>
+        
+        <strong>IMPORTANT:</strong> The system assumes that the function does
not modify the elements on which the predicate is applied. Violating this assumption
+        can lead to incorrect results.
+        </p>
 {% highlight java %}
 data.filter(new FilterFunction<Integer>() {
   public boolean filter(Integer value) { return value > 1000; }
@@ -729,7 +733,9 @@ data.mapPartition { in => in map { (_, 1) } }
       <td><strong>Filter</strong></td>
       <td>
         <p>Evaluates a boolean function for each element and retains those for which
the function
-        returns true.</p>
+        returns true.<br/>
+        <strong>IMPORTANT:</strong> The system assumes that the function does
not modify the element on which the predicate is applied.
+        Violating this assumption can lead to incorrect results.</p>
 {% highlight scala %}
 data.filter { _ > 1000 }
 {% endhighlight %}

http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/e71ee0b7/flink-core/src/main/java/org/apache/flink/api/common/functions/FilterFunction.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/functions/FilterFunction.java
b/flink-core/src/main/java/org/apache/flink/api/common/functions/FilterFunction.java
index 0a7f166..1f21a96 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/functions/FilterFunction.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/functions/FilterFunction.java
@@ -21,8 +21,8 @@ package org.apache.flink.api.common.functions;
 import java.io.Serializable;
 
 /**
- * base interface for Filter functions. A filter function take elements and evaluates a
- * predicate on them to decide whether to keep the element, or to discard it.
+ * A filter function is a predicate applied individually to each record.
+ * The predicate decides whether to keep the element, or to discard it.
  * <p>
  * The basic syntax for using a FilterFunction is as follows:
  * <pre><blockquote>
@@ -30,6 +30,10 @@ import java.io.Serializable;
  * 
  * DataSet<X> result = input.filter(new MyFilterFunction());
  * </blockquote></pre>
+ * <p>
+ * <strong>IMPORTANT:</strong> The system assumes that the function does not
+ * modify the elements on which the predicate is applied. Violating this assumption
+ * can lead to incorrect results.
  * 
  * @param <T> The type of the filtered elements.
  */
@@ -37,6 +41,10 @@ public interface FilterFunction<T> extends Function, Serializable
{
 	
 	/**
 	 * The filter function that evaluates the predicate.
+	 * <p>
+	 * <strong>IMPORTANT:</strong> The system assumes that the function does not
+	 * modify the elements on which the predicate is applied. Violating this assumption
+	 * can lead to incorrect results.
 	 * 
 	 * @param value The value to be filtered.
 	 * @return True for values that should be retained, false for values to be filtered out.


Mime
View raw message