support MATCH_RECOGNIZE

This commit is contained in:
HSunboy
2019-10-21 16:52:16 +08:00
parent eb0d32751b
commit 2962271262
14 changed files with 14821 additions and 13946 deletions

View File

@ -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();
})
})
})