我想创建一个包含 MATCH_RECOGNIZE
声明。这会导致以下错误:
org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "MATCH_RECOGNIZE" at line 3, column 79.
Was expecting one of:
<EOF>
"EXCEPT" ...
"FETCH" ...
"GROUP" ...
"HAVING" ...
"INTERSECT" ...
"LIMIT" ...
"OFFSET" ...
"ORDER" ...
"MINUS" ...
"TABLESAMPLE" ...
"UNION" ...
"WHERE" ...
"WINDOW" ...
"(" ...
"NATURAL" ...
"JOIN" ...
"INNER" ...
"LEFT" ...
"RIGHT" ...
"FULL" ...
"CROSS" ...
"," ...
"OUTER" ...
如果你想重现这个问题,你可以按照ververica的培训,其中包括比赛。
初始设置后,创建以下视图:
CREATE VIEW `RideView`
AS
SELECT rideId, TIMESTAMPDIFF(MINUTE, startT, endT) AS durationMin
FROM Rides
MATCH_RECOGNIZE (
PARTITION BY rideId
ORDER BY rideTime
MEASURES
S.rideTime AS startT,
E.rideTime AS endT
AFTER MATCH SKIP PAST LAST ROW
PATTERN (S E)
DEFINE
S AS S.isStart,
E AS NOT E.isStart
);
只是跑步 SELECT * FROM RideView
会引发问题。
这并不意外,因为flink文档中说
目前,match\u recognize子句只能应用于append表。此外,它还总是生成一个附加表(https://ci.apache.org/projects/flink/flink-docs-stable/dev/table/streaming/match_recognize.html#sql-语义)。
有没有办法克服这个限制,把match\u recognize和 CREATE VIEW AS <query>
?
暂无答案!
目前还没有任何答案,快来回答吧!