You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2015/07/23 17:51:27 UTC

flink git commit: [FLINK-2385] [scala api] Add parenthesis to 'distinct' transformation.

Repository: flink
Updated Branches:
  refs/heads/master 222245428 -> 5d475f887


[FLINK-2385] [scala api] Add parenthesis to 'distinct' transformation.

This closes #933


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

Branch: refs/heads/master
Commit: 5d475f88784f796e054d7cff2492b9989d3f47d6
Parents: 2222454
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Jul 21 16:55:44 2015 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Jul 23 17:50:35 2015 +0200

----------------------------------------------------------------------
 .../org/apache/flink/api/scala/DataSet.scala    | 42 ++++++++++----------
 .../scala/operators/DistinctOperatorTest.scala  | 11 +----
 2 files changed, 22 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/5d475f88/flink-scala/src/main/scala/org/apache/flink/api/scala/DataSet.scala
----------------------------------------------------------------------
diff --git a/flink-scala/src/main/scala/org/apache/flink/api/scala/DataSet.scala b/flink-scala/src/main/scala/org/apache/flink/api/scala/DataSet.scala
index 3a0f6d9..167aa26 100644
--- a/flink-scala/src/main/scala/org/apache/flink/api/scala/DataSet.scala
+++ b/flink-scala/src/main/scala/org/apache/flink/api/scala/DataSet.scala
@@ -88,7 +88,7 @@ class DataSet[T: ClassTag](set: JavaDataSet[T]) {
   /**
    * Returns the TypeInformation for the elements of this DataSet.
    */
-  def getType(): TypeInformation[T] = set.getType
+  def getType(): TypeInformation[T] = set.getType()
 
   /**
    * Returns the execution environment associated with the current DataSet.
@@ -730,22 +730,22 @@ class DataSet[T: ClassTag](set: JavaDataSet[T]) {
   }
 
   /**
-   * Returns a distinct set of a {@link DataSet}.
-   * <p>
-   * If the input is a composite type (Tuple or Pojo type), distinct is performed on all fields
-   * and each field must be a key type.
+   * Returns a distinct set of this DataSet.
+   * 
+   * <p>If the input is a composite type (Tuple or Pojo type), distinct is performed on all fields
+   * and each field must be a key type.</p>
    */
-  def distinct: DataSet[T] = {
+  def distinct(): DataSet[T] = {
     wrap(new DistinctOperator[T](javaSet, null, getCallLocationName()))
   }
 
   /**
-   * Returns a distinct set of a {@link Tuple} {@link DataSet} using field position keys.
-   * <p>
-   * The field position keys specify the fields of Tuples on which the decision is made if
-   * two Tuples are distinct or not.
-   * <p>
-   * Note: Field position keys can only be specified for Tuple DataSets.
+   * Returns a distinct set of a tuple DataSet using field position keys.
+   * 
+   * <p>The field position keys specify the fields of Tuples on which the decision is made if
+   * two Tuples are distinct or not.</p>
+   * 
+   * <p>Note: Field position keys can only be specified for Tuple DataSets.</p>
    *
    * @param fields One or more field positions on which the distinction of the DataSet is decided.
    */
@@ -757,16 +757,16 @@ class DataSet[T: ClassTag](set: JavaDataSet[T]) {
   }
 
   /**
-   * Returns a distinct set of a {@link Tuple} {@link DataSet} using expression keys.
-   * <p>
-   * The field position keys specify the fields of Tuples or Pojos on which the decision is made
-   * if two elements are distinct or not.
+   * Returns a distinct set of this DataSet using expression keys.
+   * 
+   * <p>The field position keys specify the fields of Tuples or Pojos on which the decision is made
+   * if two elements are distinct or not.</p>
    *
-   * The field expression keys specify the fields of a
-   * {@link org.apache.flink.api.common.typeutils.CompositeType}
-   * (e.g., Tuple or Pojo type) on which the decision is made if two elements are distinct or not.
-   * In case of a {@link org.apache.flink.api.common.typeinfo.AtomicType}, only the
-   * wildcard expression ("_") is valid.
+   * <p>The field expression keys specify the fields of a
+   * [[org.apache.flink.api.common.typeutils.CompositeType]] (e.g., Tuple or Pojo type)
+   * on which the decision is made if two elements are distinct or not.
+   * In case of a [[org.apache.flink.api.common.typeinfo.AtomicType]], only the
+   * wildcard expression ("_") is valid.</p>
    *
    * @param firstField First field position on which the distinction of the DataSet is decided
    * @param otherFields Zero or more field positions on which the distinction of the DataSet

http://git-wip-us.apache.org/repos/asf/flink/blob/5d475f88/flink-tests/src/test/scala/org/apache/flink/api/scala/operators/DistinctOperatorTest.scala
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/scala/org/apache/flink/api/scala/operators/DistinctOperatorTest.scala b/flink-tests/src/test/scala/org/apache/flink/api/scala/operators/DistinctOperatorTest.scala
index 7fc53e5..a811e35 100644
--- a/flink-tests/src/test/scala/org/apache/flink/api/scala/operators/DistinctOperatorTest.scala
+++ b/flink-tests/src/test/scala/org/apache/flink/api/scala/operators/DistinctOperatorTest.scala
@@ -71,15 +71,6 @@ class DistinctOperatorTest {
     tupleDs.distinct()
   }
 
-  @Test(expected = classOf[InvalidProgramException])
-  def testDistinctByKeyIndices5(): Unit = {
-    val env = ExecutionEnvironment.getExecutionEnvironment
-    val customDs = env.fromCollection(customTypeData)
-
-    // should not work: distinct on custom type
-    customDs.distinct()
-  }
-
   @Test(expected = classOf[IllegalArgumentException])
   def testDistinctByKeyIndices6(): Unit = {
     val env = ExecutionEnvironment.getExecutionEnvironment
@@ -96,7 +87,7 @@ class DistinctOperatorTest {
 
     // should work
     try {
-      longDs.distinct
+      longDs.distinct()
     } catch {
       case e: Exception => Assert.fail()
     }