support MATCH_RECOGNIZE
This commit is contained in:
@ -133,5 +133,28 @@ describe('syntax test', () => {
|
||||
const result2 = flinksqlParser(sql2);
|
||||
expect(result2).not.toBeNull();
|
||||
});
|
||||
test('MATCH_RECOGNIZE', () => {
|
||||
const sql = `SELECT *
|
||||
FROM Ticker
|
||||
MATCH_RECOGNIZE (
|
||||
PARTITION BY symbol
|
||||
ORDER BY rowtime
|
||||
MEASURES
|
||||
START_ROW.rowtime AS start_tstamp,
|
||||
LAST(PRICE_DOWN.rowtime) AS bottom_tstamp,
|
||||
LAST(PRICE_UP.rowtime) AS end_tstamp
|
||||
ONE ROW PER MATCH
|
||||
AFTER MATCH SKIP TO LAST PRICE_UP
|
||||
PATTERN (START_ROW PRICE_DOWN+ PRICE_UP)
|
||||
DEFINE
|
||||
PRICE_DOWN AS
|
||||
(LAST(PRICE_DOWN.price, 1) IS NULL AND PRICE_DOWN.price < START_ROW.price) OR
|
||||
PRICE_DOWN.price < LAST(PRICE_DOWN.price, 1),
|
||||
PRICE_UP AS
|
||||
PRICE_UP.price > LAST(PRICE_DOWN.price, 1)
|
||||
) MR;`;
|
||||
const result = flinksqlParser(sql);
|
||||
expect(result).toBeNull();
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user