Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/905#discussion_r34627102 --- Diff: flink-tests/src/test/java/org/apache/flink/test/javaApiOperators/DistinctITCase.java --- @@ -274,4 +277,81 @@ public Integer map(POJO value) throws Exception { return (int) value.nestedPojo.longNumber; } } + + @Test + public void testCorrectnessOfDistinctOnAtomic() throws Exception { + /* + * check correctness of distinct on Integers + */ + + final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet<Integer> ds = CollectionDataSets.getIntegerDataSet(env); + DataSet<Integer> reduceDs = ds.distinct(); + + List<Integer> result = reduceDs.collect(); + + String expected = "1\n2\n3\n4\n5"; + + compareResultAsText(result, expected); + } + + @Test + public void testCorrectnessOfDistinctOnAtomicWithSelectAllChar() throws Exception { + /* + * check correctness of distinct on Strings, using Keys.ExpressionKeys.SELECT_ALL_CHAR + */ + + final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet<String> ds = CollectionDataSets.getStringDataSet(env); + DataSet<String> reduceDs = ds.union(ds).distinct("*"); + + List<String> result = reduceDs.collect(); + + String expected = "I am fine.\n" + + "Luke Skywalker\n" + + "LOL\n" + + "Hello world, how are you?\n" + + "Hi\n" + + "Hello world\n" + + "Hello\n" + + "Random comment\n"; + + compareResultAsText(result, expected); + } + + @Test(expected = InvalidProgramException.class) + public void testDistinctOnNotKeyDataType() throws Exception { --- End diff -- We usually add such failing tests to the unit tests (DistinctOperatorTest.java) instead of integration tests.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---