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:08:00 UTC

[jira] [Created] (FLINK-17751) proctime defined in ddl can't work with over window in Table api

godfrey he created FLINK-17751:
----------------------------------

             Summary: proctime defined in ddl can't work with over window in Table api
                 Key: FLINK-17751
                 URL: https://issues.apache.org/jira/browse/FLINK-17751
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: godfrey he
             Fix For: 1.11.0


the following test will get {{org.apache.flink.table.api.ValidationException: Ordering must be defined on a time attribute.}}
{code:scala}
  @Test
  def testProcTimeTableSourceOverWindow(): Unit = {
    val ddl =
      s"""
         |CREATE TABLE procTimeT (
         |  id int,
         |  val bigint,
         |  name varchar(32),
         |  proctime as PROCTIME()
         |) WITH (
         |  'connector' = 'projectable-values',
         |  'bounded' = 'false'
         |)
       """.stripMargin
    util.tableEnv.executeSql(ddl)

    val t = util.tableEnv.from("procTimeT")
      .window(Over partitionBy 'id orderBy 'proctime preceding 2.hours as 'w)
      .select('id, 'name, 'val.sum over 'w as 'valSum)
      .filter('valSum > 100)
    util.verifyPlan(t)
  }
{code}

The reason is: the type of proctime is {{TIMESTAMP(3) NOT null}}, while {{LegacyTypeInfoDataTypeConverter}} does not handle the mapping between {{Types.LOCAL_DATE_TIME}} and {{DataTypes.TIMESTAMP(3)}} with not null. 




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