You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "godfrey he (Jira)" <ji...@apache.org> on 2020/05/16 09:28:00 UTC

[jira] [Created] (FLINK-17753) watermark defined in ddl does not work in Table api

godfrey he created FLINK-17753:
----------------------------------

             Summary: watermark defined in ddl does not work in Table api
                 Key: FLINK-17753
                 URL: https://issues.apache.org/jira/browse/FLINK-17753
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: godfrey he
             Fix For: 1.11.0


the following code will get {{org.apache.flink.table.api.ValidationException: A group window expects a time attribute for grouping in a stream environment.}}

{code:java}
@Test
  def testRowTimeTableSourceGroupWindow(): Unit = {
    val ddl =
      s"""
         |CREATE TABLE rowTimeT (
         |  id int,
         |  rowtime timestamp(3),
         |  val bigint,
         |  name varchar(32),
         |  watermark for rowtime as rowtime
         |) WITH (
         |  'connector' = 'projectable-values',
         |  'bounded' = 'false'
         |)
       """.stripMargin
    util.tableEnv.executeSql(ddl)

    val t = util.tableEnv.from("rowTimeT")
      .where($"val" > 100)
      .window(Tumble over 10.minutes on 'rowtime as 'w)
      .groupBy('name, 'w)
      .select('name, 'w.end, 'val.avg)
    util.verifyPlan(t)
  }
{code}

The reason is planner does not convert {{watermarkSpecs}} in {{TableSchema}} to correct type when calling {{tableEnv.from}}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)