lava-oushudb-dt-sql-parser/test/parser/flinksql/syntax/alterStatement.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

39 lines
1.4 KiB
TypeScript

import { FlinkSQL } from '../../../../src';
describe('FlinkSQL Create Table Syntax Tests', () => {
const parser = new FlinkSQL();
// Alter statements
test('Test simple alter table Statement', () => {
const sql = `
ALTER TABLE Orders RENAME TO NewOrders;
ALTER TABLE sample_table SET ('key1'='value2');
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple alter view Statement', () => {
const sql = `
ALTER VIEW v1 RENAME TO v2;
ALTER VIEW v1 AS SELECT c1, c2 FROM tbl;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple alter database Statement', () => {
const sql = `ALTER DATABASE tempDB SET ("key1"="value1");`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple alter function Statement', () => {
const sql = `
ALTER FUNCTION tempFunction AS 'SimpleUdf';
ALTER TEMPORARY FUNCTION IF EXISTS tempFunction AS 'SimpleUdf';
ALTER TEMPORARY SYSTEM FUNCTION IF EXISTS tempFunction AS 'SimpleUdf';
ALTER FUNCTION myudf AS 'com.example.MyUdf' LANGUAGE PYTHON;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
});