pnowojski commented on a change in pull request #7440: [FLINK-10591][table]
Introduced functions to return time attributes from MATCH_RECOGNIZE
URL: https://github.com/apache/flink/pull/7440#discussion_r248304427
##########
File path:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/stream/sql/MatchRecognizeITCase.scala
##########
@@ -647,29 +704,25 @@ class MatchRecognizeITCase extends
StreamingWithStateTestBase {
val sqlQuery =
s"""
- |SELECT T.aid
+ |SELECT *
|FROM MyTable
|MATCH_RECOGNIZE (
| ORDER BY proctime
| MEASURES
- | A.id AS aid,
- | A.proctime AS aProctime,
- | LAST(A.proctime + INTERVAL '1' second) as calculatedField
+ | HOUR(MATCH_PROCTIME()) as currentHour
| PATTERN (A)
| DEFINE
- | A AS proctime >= (CURRENT_TIMESTAMP - INTERVAL '1' day)
+ | A AS A.name LIKE '%a%'
|) AS T
|""".stripMargin
val result = tEnv.sqlQuery(sqlQuery).toAppendStream[Row]
result.addSink(new StreamITCase.StringSink[Row])
env.execute()
- val expected = List("1")
+ // note sql works on timestamps in gmt
+ val expected = List(ZonedDateTime.now(ZoneId.of("GMT")).getHour.toString)
Review comment:
Will this fail in case of current hour advances between `env.execute()` line
and this line? I think this test should be moved to unit test form using
`TestHarness`, where you can freeze proc time?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services