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_r247529112
##########
File path:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/stream/sql/MatchRecognizeITCase.scala
##########
@@ -311,6 +312,61 @@ class MatchRecognizeITCase extends
StreamingWithStateTestBase {
assertEquals(expected.sorted, StreamITCase.testResults.sorted)
}
+ @Test
+ def testWindowedGroupingAppliedToMatchRecognize(): Unit = {
+ val env = StreamExecutionEnvironment.getExecutionEnvironment
+ env.setParallelism(1)
+ env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
+ val tEnv = TableEnvironment.getTableEnvironment(env)
+ StreamITCase.clear
+
+ val data = new mutable.MutableList[(String, Long, Int, Int)]
+ //first window
+ data.+=(("ACME", Time.seconds(1).toMilliseconds, 1, 1))
+ data.+=(("ACME", Time.seconds(2).toMilliseconds, 2, 2))
+ //second window
+ data.+=(("ACME", Time.seconds(4).toMilliseconds, 1, 4))
+ data.+=(("ACME", Time.seconds(5).toMilliseconds, 1, 3))
+
+
+ val t = env.fromCollection(data)
+ .assignAscendingTimestamps(e => e._2)
+ .toTable(tEnv, 'symbol, 'tstamp.rowtime, 'price, 'tax)
+ tEnv.registerTable("Ticker", t)
+
+ val sqlQuery =
+ s"""
+ |SELECT
+ | symbol,
+ | SUM(price) as price,
+ | TUMBLE_ROWTIME(tstamp, interval '3' second) as rowTime,
+ | TUMBLE_START(tstamp, interval '3' second) as startTime
+ |FROM Ticker
+ |MATCH_RECOGNIZE (
+ | PARTITION BY symbol
+ | ORDER BY tstamp
+ | MEASURES
+ | A.price as price,
+ | A.tax as tax,
+ | MATCH_ROWTIME() as tstamp
Review comment:
`tstamp` -> `timeStamp`/`rowTime`
----------------------------------------------------------------
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