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

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

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

    https://github.com/apache/flink/pull/4521#discussion_r135254243
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/stream/sql/GroupWindowTest.scala
 ---
    @@ -143,4 +143,36 @@ class GroupWindowTest extends TableTestBase {
     
         streamUtil.verifySql(sql, expected)
       }
    +
    +  @Test
    +  def testExpressionOnWindowHavingFunction() = {
    +    val sql =
    +      "SELECT " +
    +        "  COUNT(*), " +
    +        "  HOP_START(rowtime, INTERVAL '15' MINUTE, INTERVAL '1' MINUTE) " 
+
    +        "FROM MyTable " +
    +        "GROUP BY HOP(rowtime, INTERVAL '15' MINUTE, INTERVAL '1' MINUTE) 
" +
    +        "HAVING SUM(a) > 0"
    +    val expected =
    +      unaryNode(
    +        "DataStreamCalc",
    +        unaryNode(
    +          "DataStreamGroupWindowAggregate",
    +          unaryNode(
    +            "DataStreamCalc",
    +            streamTableNode(0),
    +            term("select", "rowtime, a")
    +          ),
    +          term("window", SlidingGroupWindow('w$, 'rowtime, 60000.millis, 
900000.millis)),
    +          term("select",
    +            "COUNT(*) AS EXPR$0",
    +            "SUM(a) AS $f1",
    +            "start('w$) AS w$start",
    +            "end('w$) AS w$end")
    +        ),
    +        term("select", "EXPR$0", "w$start")
    --- End diff --
    
    Isn't your condition `> 0` missing in your logical plan?


> HOP_START() HOP_END() does not work when using HAVING clause with GROUP BY 
> HOP window
> -------------------------------------------------------------------------------------
>
>                 Key: FLINK-7357
>                 URL: https://issues.apache.org/jira/browse/FLINK-7357
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.3.1
>            Reporter: Rong Rong
>            Assignee: Rong Rong
>
> The following SQL does not compile:
> {code:title=invalid_having_hop_start_sql}
> SELECT 
>   c AS k, 
>   COUNT(a) AS v, 
>   HOP_START(rowtime, INTERVAL '1' MINUTE, INTERVAL '1' MINUTE) AS 
> windowStart, 
>   HOP_END(rowtime, INTERVAL '1' MINUTE, INTERVAL '1' MINUTE) AS windowEnd 
> FROM 
>   T1 
> GROUP BY 
>   HOP(rowtime, INTERVAL '1' MINUTE, INTERVAL '1' MINUTE), 
>   c 
> HAVING 
>   SUM(b) > 1
> {code}
> While individually keeping HAVING clause or HOP_START field compiles and runs 
> without issue.
> more details: 
> https://github.com/apache/flink/compare/master...walterddr:having_does_not_work_with_hop_start_end



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to