lava-oushudb-dt-sql-parser/test/parser/flinksql/syntax/selectStatement.test.ts
Hayden a026ae0592
feat: complete Query statements of FlinkSQL (#93)
* feat: add inlineDataValueClasue rule

* test: update tests of select statements

* feat: support flinksql window TVF grammar

* test: flink sql windown TVF statement test

* feat: support grouping sets grammar

* test: window TVF Aggregation and Group Window Aggregation tests

* test: supplemental selectAggregation with test cases

* test: add Having statement test case

* feat: support flinkSql over aggregation grammar

* test: add over aggregation grammar test cases

* test: flink sql join statement test cases

* test: flink sql set Operations grammar test cases

* test: flink sql limit clause test case

* feat: remove allPlusUid and replace with uid

* feat: support flink sql pattern recognition grammar

* test: flink sql pattern recognition tests

* feat: add flink sql with clause rule

* test: flink sql with clasue select tests

* feat: rebuild flink sql parser
2023-05-17 10:30:25 +08:00

83 lines
2.3 KiB
TypeScript

import FlinkSQL from "../../../../src/parser/flinksql";
import { readSQL } from "../../../helper";
const parser = new FlinkSQL();
const features = {
base: readSQL(__dirname, "select.sql"),
withClause: readSQL(__dirname, "selectWithClause.sql"),
distinct: readSQL(__dirname, "selectDistinct.sql"),
windowTVF: readSQL(__dirname, "selectWindowTVF.sql"),
aggregation: readSQL(__dirname, "selectAggregation.sql"),
join: readSQL(__dirname, "selectJoin.sql"),
setOperation: readSQL(__dirname, "selectSetOperations.sql"),
pattern: readSQL(__dirname, "selectPatternRecognition.sql")
};
describe("FlinkSQL Query Statement Tests", () => {
describe("Base Select", () => {
features.base.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
});
});
describe("With Clause Select", () => {
features.withClause.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
});
});
describe("Select DISTINCT", () => {
features.distinct.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
describe("Select Window TVF", () => {
features.windowTVF.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
describe("Select Aggregation", () => {
features.aggregation.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
describe("Select Join", () => {
features.join.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
describe("Select Set Operations", () => {
features.setOperation.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
describe("Select Pattern Recognition", () => {
features.pattern.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0);
});
})
})
});