[ 
https://issues.apache.org/jira/browse/FLINK-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15176674#comment-15176674
 ] 

ASF GitHub Bot commented on FLINK-3564:
---------------------------------------

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1754#discussion_r54808793
  
    --- Diff: 
flink-libraries/flink-table/src/test/java/org/apache/flink/api/java/table/test/DistinctITCase.java
 ---
    @@ -0,0 +1,92 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.api.java.table.test;
    +
    +import java.util.List;
    +import org.apache.flink.api.java.DataSet;
    +import org.apache.flink.api.java.ExecutionEnvironment;
    +import org.apache.flink.api.java.table.TableEnvironment;
    +import org.apache.flink.api.java.tuple.Tuple3;
    +import org.apache.flink.api.java.tuple.Tuple5;
    +import org.apache.flink.api.table.Row;
    +import org.apache.flink.api.table.Table;
    +import org.apache.flink.test.javaApiOperators.util.CollectionDataSets;
    +import org.apache.flink.test.util.MultipleProgramsTestBase;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.junit.runners.Parameterized;
    +
    +@RunWith(Parameterized.class)
    +public class DistinctITCase extends MultipleProgramsTestBase {
    +
    +   public DistinctITCase(TestExecutionMode mode){
    +           super(mode);
    +   }
    +
    +   @Test
    +   public void testAllDistinct() throws Exception {
    +           ExecutionEnvironment env = 
ExecutionEnvironment.getExecutionEnvironment();
    +           TableEnvironment tableEnv = new TableEnvironment();
    +
    +           DataSet<Tuple3<Integer, Long, String>> input = 
CollectionDataSets.getSmall3TupleDataSet(env);
    +
    +           Table table = tableEnv.fromDataSet(input, "a, b, c");
    +
    +           Table distinct = table.distinct();
    +
    +           DataSet<Row> ds = tableEnv.toDataSet(distinct, Row.class);
    +           List<Row> results = ds.collect();
    +           String expected = "1,1,Hi\n" + "2,2,Hello\n" + "3,2,Hello 
world\n";
    +           compareResultAsText(results, expected);
    +   }
    +
    +   @Test
    +   public void testDistinct() throws Exception {
    +           ExecutionEnvironment env = 
ExecutionEnvironment.getExecutionEnvironment();
    +           TableEnvironment tableEnv = new TableEnvironment();
    +
    +           DataSet<Tuple3<Integer, Long, String>> input = 
CollectionDataSets.getSmall3TupleDataSet(env);
    --- End diff --
    
    Why not use `get3TupleDataSet()` which has more duplicates? 


> Implement distinct() for Table API
> ----------------------------------
>
>                 Key: FLINK-3564
>                 URL: https://issues.apache.org/jira/browse/FLINK-3564
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>            Priority: Minor
>
> This is only syntactic sugar for grouping of all fields.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to