Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/2169#discussion_r69048813 --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/table/SetOperationsITCase.scala --- @@ -139,4 +154,105 @@ class UnionITCase( // Must fail. Tables are bound to different TableEnvironments. ds1.unionAll(ds2).select('c) } + + @Test + def testSetMinusAll(): Unit = { + val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment + val tEnv = TableEnvironment.getTableEnvironment(env, config) + + val ds1 = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv, 'a, 'b, 'c) + val ds2 = CollectionDataSets.getOneElement3TupleDataSet(env).toTable(tEnv, 'a, 'b, 'c) + + val minusDs = ds1.minusAll(ds2).select('c) + + val results = minusDs.toDataSet[Row].collect() + val expected = "Hello\n" + "Hello world\n" + TestBaseUtils.compareResultAsText(results.asJava, expected) + } + + @Test + def testSetMinusAllWithDuplicates(): Unit = { + val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment + val tEnv = TableEnvironment.getTableEnvironment(env, config) + + val ds1 = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv, 'a, 'b, 'c) + val ds2 = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv, 'a, 'b, 'c) + val ds3 = CollectionDataSets.getOneElement3TupleDataSet(env).toTable(tEnv, 'a, 'b, 'c) + + val minusDs = ds1.unionAll(ds2).minusAll(ds3).select('c) + + val results = minusDs.toDataSet[Row].collect() + val expected = "Hello\n" + "Hello world\n" + + "Hello\n" + "Hello world\n" + TestBaseUtils.compareResultAsText(results.asJava, expected) + } + + @Test + def testSetMinus(): Unit = { --- End diff -- Can you combine this and the next test by using test data that covers both cases for different records, i.e., have some records with duplicates in this first, second, none, and both data sets.
--- 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. ---