feat: update the builtin funcs of flinksql (#102)
* style: put evrry branch on a single line * feat: support ASYMMETRIC and SYMMETRIC for between and * feat: support SIMILAR TO predicate * feat: support nested boolean expression * feat: support escape to like and similar in flink sql * test: add where clause test cases * feat: add reservedKeywordsUsedAsFunctionName rule * feat: add timepointLiteral rule and improve function call grammar
This commit is contained in:
27
test/parser/flinksql/syntax/fixtures/selectWhere.sql
Normal file
27
test/parser/flinksql/syntax/fixtures/selectWhere.sql
Normal file
@ -0,0 +1,27 @@
|
||||
SELECT id, age FROM table1 WHERE age IS NOT NULL;
|
||||
|
||||
SELECT id, age FROM table1 WHERE age IS NOT DISTINCT FROM 12;
|
||||
|
||||
SELECT id, age FROM table1 WHERE age BETWEEN SYMMETRIC 25 AND 18;
|
||||
|
||||
SELECT id, age FROM table1 WHERE age NOT LIKE "%aa_d%" ESCAPE "a";
|
||||
|
||||
SELECT addr FROM table1 WHERE addr NOT SIMILAR TO '%(123|yz)%' ESCAPE "y";
|
||||
|
||||
SELECT id, age FROM table1 WHERE age NOT IN (18,19,20);
|
||||
|
||||
SELECT id FROM table1 WHERE id NOT IN ( SELECT * FROM table2 );
|
||||
|
||||
SELECT S,SNAME
|
||||
FROM S
|
||||
WHERE NOT EXISTS
|
||||
(SELECT *
|
||||
FROM C
|
||||
WHERE NOT EXISTS
|
||||
(SELECT *
|
||||
FROM SC
|
||||
WHERE SC.S=S.S AND SC.C=C.C));
|
||||
|
||||
SELECT id, age FROM table1 WHERE age > 18 OR id = 1;
|
||||
|
||||
SELECT id, age FROM table1 WHERE age > 18 AND id > 10;
|
@ -11,7 +11,8 @@ const features = {
|
||||
aggregation: readSQL(__dirname, "selectAggregation.sql"),
|
||||
join: readSQL(__dirname, "selectJoin.sql"),
|
||||
setOperation: readSQL(__dirname, "selectSetOperations.sql"),
|
||||
pattern: readSQL(__dirname, "selectPatternRecognition.sql")
|
||||
pattern: readSQL(__dirname, "selectPatternRecognition.sql"),
|
||||
where: readSQL(__dirname, "selectWhere.sql"),
|
||||
};
|
||||
|
||||
describe("FlinkSQL Query Statement Tests", () => {
|
||||
@ -79,4 +80,12 @@ describe("FlinkSQL Query Statement Tests", () => {
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
describe("Select Where", () => {
|
||||
features.where.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
|
Reference in New Issue
Block a user