lava-oushudb-dt-sql-parser/test/parser/flinksql/syntax/dropStatement.test.ts
nankaNULL 4f02f9aca0
Feat/flink grammar (#73)
* feat: complete flink sql insert statement

* feat: complete flink sql drop statement

* feat: complete flink sql alert statement

* feat: complete flink sql create statement, remove console log

* feat: complete flink sql describe, show, explain, use statement

* feat(flinksql): add statement, such as set, load

* fix(flinksql): fix insert, add temporary table
2023-02-27 19:03:32 +08:00

50 lines
1.6 KiB
TypeScript

import { FlinkSQL } from '../../../../src';
describe('FlinkSQL Create Table Syntax Tests', () => {
const parser = new FlinkSQL();
// Drop statements
test('Test Simple Drop Catalog Statement', () => {
const sql = `
DROP CATALOG catalog1;
DROP CATALOG IF EXISTS catalog2;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Simple Drop Table Statement', () => {
const sql = `
DROP TABLE Orders;
DROP TABLE IF EXISTS Orders;
DROP TEMPORARY TABLE IF EXISTS Orders;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Simple Drop Database Statement', () => {
const sql = `
DROP DATABASE Orders;
DROP DATABASE IF EXISTS Orders RESTRICT;
DROP DATABASE IF EXISTS Orders CASCADE;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Simple Drop View Statement', () => {
const sql = `
DROP VIEW Orders;
DROP TEMPORARY VIEW IF EXISTS Orders;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Simple Drop Function Statement', () => {
const sql = `
DROP FUNCTION Orders;
DROP TEMPORARY FUNCTION IF EXISTS Orders;
DROP TEMPORARY SYSTEM FUNCTION IF EXISTS Orders;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
});