[ 
https://issues.apache.org/jira/browse/FLINK-13742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated FLINK-13742:
-----------------------------------
    Labels: pull-request-available  (was: )

> Fix code generation when aggregation contains both distinct aggregate with 
> and without filter
> ---------------------------------------------------------------------------------------------
>
>                 Key: FLINK-13742
>                 URL: https://issues.apache.org/jira/browse/FLINK-13742
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: Jark Wu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.9.1
>
>
> The following test will fail when the aggregation contains {{COUNT(DISTINCT 
> c)}} and {{COUNT(DISTINCT c) filter ...}}.
> {code:java}
>         @Test
>   def testDistinctWithMultiFilter(): Unit = {
>     val sqlQuery =
>       "SELECT b, " +
>         "  SUM(DISTINCT (a * 3)), " +
>         "  COUNT(DISTINCT SUBSTRING(c FROM 1 FOR 2))," +
>         "  COUNT(DISTINCT c)," +
>         "  COUNT(DISTINCT c) filter (where MOD(a, 3) = 0)," +
>         "  COUNT(DISTINCT c) filter (where MOD(a, 3) = 1) " +
>         "FROM MyTable " +
>         "GROUP BY b"
>     val t = 
> failingDataSource(StreamTestData.get3TupleData).toTable(tEnv).as('a, 'b, 'c)
>     tEnv.registerTable("MyTable", t)
>     val result = tEnv.sqlQuery(sqlQuery).toRetractStream[Row]
>     val sink = new TestingRetractSink
>     result.addSink(sink)
>     env.execute()
>     val expected = List(
>       "1,3,1,1,0,1",
>       "2,15,1,2,1,0",
>       "3,45,3,3,1,1",
>       "4,102,1,4,1,2",
>       "5,195,1,5,2,1",
>       "6,333,1,6,2,2")
>     assertEquals(expected.sorted, sink.getRetractResults.sorted)
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to