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

    https://github.com/apache/flink/pull/4279#discussion_r126534907
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/AggregationsTest.scala
 ---
    @@ -39,4 +40,42 @@ class AggregationsTest extends TableTestBase {
     
         streamUtil.tEnv.sql(sqlQuery)
       }
    +
    +  @Test
    +  def testDistinct(): Unit = {
    +    val sql = "SELECT DISTINCT a, b, c FROM MyTable"
    +
    +    val expected =
    +      unaryNode(
    +        "DataStreamGroupAggregate",
    +        streamTableNode(0),
    +        term("groupBy", "a, b, c"),
    +        term("select", "a, b, c")
    +      )
    +    streamUtil.verifySql(sql, expected)
    +  }
    +
    +  @Test
    +  def testDistinctAfterAggregate(): Unit = {
    +    val sql = "SELECT DISTINCT a FROM MyTable GROUP BY a, b, c"
    +
    +    val expected =
    +      unaryNode(
    +        "DataStreamGroupAggregate",
    --- End diff --
    
    Shouldn't this query be optimized to only have a single 
`DataStreamGroupAggregate`? @wuchong can you check this and open a JIRA if this 
is the case? Thank you


---
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.
---

Reply via email to