4f02f9aca0
* 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
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { FlinkSQL } from '../../../../src';
|
|
|
|
describe('FlinkSQL Create Table Syntax Tests', () => {
|
|
const parser = new FlinkSQL();
|
|
// Create statements
|
|
test('Test Create Catalog Statement', () => {
|
|
const sql = `
|
|
CREATE CATALOG c1
|
|
WITH (
|
|
'key1'='value1',
|
|
'key2'='value2'
|
|
)
|
|
`;
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(0);
|
|
});
|
|
test('Test simple Create Database Statement', () => {
|
|
const sql = `
|
|
CREATE DATABASE IF NOT EXISTS dataApi
|
|
WITH (
|
|
"owner" = "admin"
|
|
);
|
|
`;
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(0);
|
|
});
|
|
test('Test simple Create View Statement', () => {
|
|
const sql = `
|
|
CREATE TEMPORARY VIEW IF NOT EXISTS tempView
|
|
AS SELECT product, amount FROM Orders;
|
|
`;
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(0);
|
|
});
|
|
test('Test simple Create Function Statement', () => {
|
|
const sql = `
|
|
CREATE FUNCTION IF NOT EXISTS tempFunction AS 'SimpleUdf';
|
|
CREATE TEMPORARY FUNCTION function1 AS 'org.apache.fink.function.function1' LANGUAGE JAVA USING JAR 'file:///path/to/test.jar', JAR 'hdfs:///path/to/test2.jar';
|
|
`;
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(0);
|
|
});
|
|
});
|