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

Timo Walther commented on FLINK-24168:
--------------------------------------

Syntactically, I would also prefer {{MATCH_ROWTIME(rowtime)}}. However, we need 
to check whether the semantics are correct in this case. The documentation 
states:

{noformat}
Returns the timestamp of the last row that was mapped to the given pattern.
{noformat}

If we just pass {{rowtime}} what does this mean? 

{noformat}
If no pattern variable is specified (e.g. SUM(price)), an expression references 
the default pattern variable * which references all variables in the pattern. 
In other words, it creates a list of all the rows mapped so far to any variable 
plus the current row.
{noformat}

Sounds ok to me. But please double check.


> Rowtime type is not correct for windowTableFunction or OverAggregate follows 
> after Match because the output type does not updated after input rowtime 
> attribute changed from rowtime to rowtime_ltz
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-24168
>                 URL: https://issues.apache.org/jira/browse/FLINK-24168
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.14.0
>            Reporter: JING ZHANG
>            Assignee: JING ZHANG
>            Priority: Blocker
>              Labels: pull-request-available
>             Fix For: 1.14.0
>
>
> Rowtime type is not correct for windowTableFunction or OverAggregate on Match 
> because the output type does not updated after input rowtime attribute 
> changed from rowtime to rowtime_ltz in `RelTimeIndicator`.
> The bug could be reproduced by the following two cases:
> {code:java}
> @Test
> def testWindowTVFOnMatchRecognizeOnRowtimeLTZ(): Unit = {
>   val sqlQuery =
>     s"""
>        |SELECT
>        |  *
>        |FROM Ticker
>        |MATCH_RECOGNIZE (
>        |  PARTITION BY symbol
>        |  ORDER BY ts_ltz
>        |  MEASURES
>        |    A.price as price,
>        |    A.tax as tax,
>        |    MATCH_ROWTIME() as matchRowtime
>        |  ONE ROW PER MATCH
>        |  PATTERN (A)
>        |  DEFINE
>        |    A AS A.price > 0
>        |) AS T
>        |""".stripMargin
>   val table = util.tableEnv.sqlQuery(sqlQuery)
>   util.tableEnv.registerTable("T", table)
>   val sqlQuery1 =
>     s"""
>        |SELECT *
>        |FROM TABLE(TUMBLE(TABLE T, DESCRIPTOR(matchRowtime), INTERVAL '3' 
> second))
>        |""".stripMargin
>   util.verifyRelPlanWithType(sqlQuery1)
> }
> @Test
> def testOverWindowOnMatchRecognizeOnRowtimeLTZ(): Unit = {
>   val sqlQuery =
>     s"""
>        |SELECT
>        |  *
>        |FROM Ticker
>        |MATCH_RECOGNIZE (
>        |  PARTITION BY symbol
>        |  ORDER BY ts_ltz
>        |  MEASURES
>        |    A.price as price,
>        |    A.tax as tax,
>        |    MATCH_ROWTIME() as matchRowtime
>        |  ONE ROW PER MATCH
>        |  PATTERN (A)
>        |  DEFINE
>        |    A AS A.price > 0
>        |) AS T
>        |""".stripMargin
>   val table = util.tableEnv.sqlQuery(sqlQuery)
>   util.tableEnv.registerTable("T", table)
>   val sqlQuery1 =
>     """
>       |SELECT
>       |  symbol,
>       |  price,
>       |  tax,
>       |  matchRowtime,
>       |  SUM(price) OVER (
>       |    PARTITION BY symbol ORDER BY matchRowtime RANGE UNBOUNDED 
> PRECEDING) as price_sum
>       |FROM T
>     """.stripMargin
>   util.verifyRelPlanWithType(sqlQuery1)
> }
> {code}
>  



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

Reply via email to