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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Shang Yuanchun (Jira)
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)