refactor: standard naming (#278)
* refactor: rename flinksql to flink * refactor: rename pgsql to postgresql * refactor: rename trinosql to trino * refactor: replace all default exports with named export * refactor: rename basicParser to basicSQL * refactor: rename basic-parser-types to types * refactor: replace arrow func with plain func
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSqlSplitListener, TrinoEntityCollector } from 'src/parser/trino';
|
||||
import { TrinoSQL, TrinoSqlSplitListener, TrinoEntityCollector } from 'src/parser/trino';
|
||||
import { ParseTreeListener } from 'antlr4ng';
|
||||
import { TrinoSqlListener } from 'src/lib/trinosql/TrinoSqlListener';
|
||||
import { EntityContextType } from 'src/parser/common/basic-parser-types';
|
||||
import { TrinoSqlListener } from 'src/lib/trino/TrinoSqlListener';
|
||||
import { EntityContextType } from 'src/parser/common/types';
|
||||
import { StmtContextType } from 'src/parser/common/entityCollector';
|
||||
|
||||
const commonSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'common.sql'), 'utf-8');
|
||||
|
@ -1,5 +1,5 @@
|
||||
import TrinoSQL, { TrinoSqlSplitListener } from 'src/parser/trino';
|
||||
import { TrinoSqlListener } from 'src/lib/trinosql/TrinoSqlListener';
|
||||
import { TrinoSQL, TrinoSqlSplitListener } from 'src/parser/trino';
|
||||
import { TrinoSqlListener } from 'src/lib/trino/TrinoSqlListener';
|
||||
|
||||
const validSQL1 = `INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
|
@ -1,10 +1,10 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
|
||||
describe('trinoSQL Lexer tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
const sql = 'SELECT * FROM table1';
|
||||
const tokens = parser.getAllTokens(sql);
|
||||
const tokens = trino.getAllTokens(sql);
|
||||
|
||||
test('token counts', () => {
|
||||
expect(tokens.length).toBe(7);
|
||||
|
@ -1,13 +1,13 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSqlListener } from 'src/lib/trinosql/TrinoSqlListener';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { TrinoSqlListener } from 'src/lib/trino/TrinoSqlListener';
|
||||
import { ParseTreeListener } from 'antlr4ng';
|
||||
|
||||
describe('trino SQL Listener Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
const sql = `select id,name,sex from ${expectTableName};`;
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
const parseTree = parser.parse(sql);
|
||||
const parseTree = trino.parse(sql);
|
||||
|
||||
test('Listener enterTableName', async () => {
|
||||
let result = '';
|
||||
@ -22,7 +22,7 @@ describe('trino SQL Listener Tests', () => {
|
||||
}
|
||||
const listenTableName = new MyListener();
|
||||
|
||||
await parser.listen(listenTableName as ParseTreeListener, parseTree);
|
||||
await trino.listen(listenTableName as ParseTreeListener, parseTree);
|
||||
expect(result).toBe(expectTableName);
|
||||
});
|
||||
|
||||
@ -36,7 +36,7 @@ describe('trino SQL Listener Tests', () => {
|
||||
`CREATE TABLE IF NOT EXISTS foo AS SELECT * FROM t;`,
|
||||
];
|
||||
const sql = singleStatementArr.join('\n');
|
||||
const sqlSlices = parser.splitSQLByStatement(sql);
|
||||
const sqlSlices = trino.splitSQLByStatement(sql);
|
||||
|
||||
expect(sqlSlices).not.toBeNull();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/basic-parser-types';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/types';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'multipleStatement.sql'),
|
||||
@ -9,14 +9,14 @@ const syntaxSql = fs.readFileSync(
|
||||
);
|
||||
|
||||
describe('TrinoSQL Multiple Statements Syntax Suggestion', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
test('Create table ', () => {
|
||||
const pos: CaretPosition = {
|
||||
lineNumber: 1,
|
||||
column: 14,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE_CREATE
|
||||
);
|
||||
@ -30,7 +30,7 @@ describe('TrinoSQL Multiple Statements Syntax Suggestion', () => {
|
||||
lineNumber: 9,
|
||||
column: 20,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE
|
||||
);
|
||||
@ -44,7 +44,7 @@ describe('TrinoSQL Multiple Statements Syntax Suggestion', () => {
|
||||
lineNumber: 15,
|
||||
column: 13,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE
|
||||
);
|
||||
@ -58,7 +58,7 @@ describe('TrinoSQL Multiple Statements Syntax Suggestion', () => {
|
||||
lineNumber: 21,
|
||||
column: 65,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||
const suggestion = syntaxes?.find(
|
||||
(syn) => syn.syntaxContextType === EntityContextType.TABLE
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/basic-parser-types';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/types';
|
||||
import { commentOtherLine } from 'test/helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
@ -9,7 +9,7 @@ const syntaxSql = fs.readFileSync(
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
describe('PostgreSQL Syntax Suggestion with collect entity', () => {
|
||||
describe('PostgreSql Syntax Suggestion with collect entity', () => {
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
test('select with no column', () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/basic-parser-types';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { CaretPosition, EntityContextType } from 'src/parser/common/types';
|
||||
import { commentOtherLine } from 'test/helper';
|
||||
|
||||
const syntaxSql = fs.readFileSync(
|
||||
@ -10,12 +10,12 @@ const syntaxSql = fs.readFileSync(
|
||||
);
|
||||
|
||||
describe('Trino SQL Syntax Suggestion', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
test('Validate Syntax SQL', () => {
|
||||
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||
expect(trino.validate(syntaxSql).length).not.toBe(0);
|
||||
expect(trino.validate(syntaxSql).length).not.toBe(0);
|
||||
expect(trino.validate(syntaxSql).length).not.toBe(0);
|
||||
});
|
||||
|
||||
test('Insert table ', () => {
|
||||
@ -23,7 +23,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 1,
|
||||
column: 18,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -41,7 +41,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
column: 20,
|
||||
};
|
||||
const syntaxes =
|
||||
parser.getSuggestionAtCaretPosition(commentOtherLine(syntaxSql, pos.lineNumber), pos)
|
||||
trino.getSuggestionAtCaretPosition(commentOtherLine(syntaxSql, pos.lineNumber), pos)
|
||||
?.syntax ?? [];
|
||||
|
||||
const suggestion = syntaxes?.find(
|
||||
@ -60,7 +60,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 5,
|
||||
column: 17,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -77,7 +77,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 7,
|
||||
column: 26,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -94,7 +94,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 9,
|
||||
column: 28,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -111,7 +111,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 11,
|
||||
column: 15,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -128,7 +128,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 13,
|
||||
column: 27,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -145,7 +145,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 15,
|
||||
column: 17,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -162,7 +162,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 17,
|
||||
column: 26,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -180,7 +180,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
column: 21,
|
||||
};
|
||||
const syntaxes =
|
||||
parser.getSuggestionAtCaretPosition(commentOtherLine(syntaxSql, pos.lineNumber), pos)
|
||||
trino.getSuggestionAtCaretPosition(commentOtherLine(syntaxSql, pos.lineNumber), pos)
|
||||
?.syntax ?? [];
|
||||
|
||||
const suggestion = syntaxes?.find(
|
||||
@ -198,7 +198,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 21,
|
||||
column: 22,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -215,7 +215,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 23,
|
||||
column: 30,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -233,7 +233,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 25,
|
||||
column: 37,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -251,7 +251,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 27,
|
||||
column: 31,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -269,7 +269,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 29,
|
||||
column: 32,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -287,7 +287,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 31,
|
||||
column: 28,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -304,7 +304,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 33,
|
||||
column: 21,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -321,7 +321,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 35,
|
||||
column: 27,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
@ -338,7 +338,7 @@ describe('Trino SQL Syntax Suggestion', () => {
|
||||
lineNumber: 37,
|
||||
column: 27,
|
||||
};
|
||||
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||
const syntaxes = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||
pos
|
||||
)?.syntax;
|
||||
|
@ -1,20 +1,20 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { CaretPosition } from 'src/parser/common/basic-parser-types';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { CaretPosition } from 'src/parser/common/types';
|
||||
import { commentOtherLine } from 'test/helper';
|
||||
|
||||
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||
|
||||
describe('Trino SQL Token Suggestion', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
test('After ALTER', () => {
|
||||
const pos: CaretPosition = {
|
||||
lineNumber: 1,
|
||||
column: 7,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -27,7 +27,7 @@ describe('Trino SQL Token Suggestion', () => {
|
||||
lineNumber: 3,
|
||||
column: 8,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -47,7 +47,7 @@ describe('Trino SQL Token Suggestion', () => {
|
||||
lineNumber: 5,
|
||||
column: 12,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -60,7 +60,7 @@ describe('Trino SQL Token Suggestion', () => {
|
||||
lineNumber: 7,
|
||||
column: 8,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -73,7 +73,7 @@ describe('Trino SQL Token Suggestion', () => {
|
||||
lineNumber: 9,
|
||||
column: 10,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -86,7 +86,7 @@ describe('Trino SQL Token Suggestion', () => {
|
||||
lineNumber: 11,
|
||||
column: 6,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
@ -105,7 +105,7 @@ describe('Trino SQL Token Suggestion', () => {
|
||||
lineNumber: 13,
|
||||
column: 8,
|
||||
};
|
||||
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||
const suggestion = trino.getSuggestionAtCaretPosition(
|
||||
commentOtherLine(tokenSql, pos.lineNumber),
|
||||
pos
|
||||
)?.keywords;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -9,25 +9,25 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Alter Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
features.table.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.view.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.schema.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.materializedView.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Analyze Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// analyze statements
|
||||
features.analyze.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Call Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// call statements
|
||||
features.call.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Comment Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// Comment statements
|
||||
features.comment.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Commit Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// commit statements
|
||||
features.commit.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -11,36 +11,36 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Create Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
features.table.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.view.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.schema.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
features.tableAsSelect.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.role.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.materializedView.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL deallocatePrepare Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// deallocate_prepare statements
|
||||
features.deallocatePrepare.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Delete Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// delete statements
|
||||
features.delete.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Deny Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// deny statements
|
||||
features.deny.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Describe Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// describe statements
|
||||
features.describe.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -11,36 +11,36 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Drop Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
features.table.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.view.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.schema.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
features.column.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.role.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.materializedView.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Execute Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// execute statements
|
||||
features.execute.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Explain Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// explain statements
|
||||
features.explain.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Grant Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// grant statements
|
||||
features.grant.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,10 +6,10 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Insert Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
features.insertIntoTable.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Match Recognize Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// match recognize statements
|
||||
features.matchRecognize.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Merge Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// merge statements
|
||||
features.merge.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Prepare Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// prepare statements
|
||||
features.prepare.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Refresh Materialized View Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// refresh materialized view statements
|
||||
features.refreshMaterializedView.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Reset Session Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// reset session statements
|
||||
features.resetSession.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -7,16 +7,16 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Revoke Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// revoke statements
|
||||
features.revoke.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.revokeRoles.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Rollback Transaction Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// rollback transaction statements
|
||||
features.rollbackTransaction.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -17,66 +17,66 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Select Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
features.select.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithClause.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithSetOperations.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
features.selectWithSubQueries.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithTableSample.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithRowType.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithOffset.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithJoin.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithFetch.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithUNNEST.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithExists.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.selectWithUnion.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -9,26 +9,26 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Set Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// set statements
|
||||
features.role.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.path.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.session.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.timeZone.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -17,61 +17,61 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Show Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// show statements
|
||||
features.tables.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.catalogs.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.columns.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.functions.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.grants.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.roleGrants.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.roles.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.schemas.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.session.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.statsForQuery.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
features.stats.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Start Transaction Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// start transaction statements
|
||||
features.startTransaction.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Truncate Table Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// truncate table statements
|
||||
features.truncateTable.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Update Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// update statements
|
||||
features.update.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Use Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// use statements
|
||||
features.use.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Values Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// values statements
|
||||
features.values.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { readSQL } from 'test/helper';
|
||||
|
||||
const features = {
|
||||
@ -6,11 +6,11 @@ const features = {
|
||||
};
|
||||
|
||||
describe('TrinoSQL Window With Row Pattern Recognition Statements Syntax Tests', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
// window with row pattern recognition statements
|
||||
features.windowWithRowPatternRecognition.forEach((sql) => {
|
||||
it(sql, () => {
|
||||
expect(parser.validate(sql).length).toBe(0);
|
||||
expect(trino.validate(sql).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,16 +1,16 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
|
||||
const randomText = `dhsdansdnkla ndjnsla ndnalks`;
|
||||
const unCompleteSQL = `CREATE TABLE`;
|
||||
|
||||
describe('Trino SQL validate invalid sql', () => {
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
test('validate random text', () => {
|
||||
expect(parser.validate(randomText).length).not.toBe(0);
|
||||
expect(trino.validate(randomText).length).not.toBe(0);
|
||||
});
|
||||
|
||||
test('validate unComplete sql', () => {
|
||||
expect(parser.validate(unCompleteSQL).length).not.toBe(0);
|
||||
expect(trino.validate(unCompleteSQL).length).not.toBe(0);
|
||||
});
|
||||
});
|
||||
|
@ -1,13 +1,13 @@
|
||||
import TrinoSQL from 'src/parser/trino';
|
||||
import { TrinoSqlVisitor } from 'src/lib/trinosql/TrinoSqlVisitor';
|
||||
import { TrinoSQL } from 'src/parser/trino';
|
||||
import { TrinoSqlVisitor } from 'src/lib/trino/TrinoSqlVisitor';
|
||||
import { AbstractParseTreeVisitor } from 'antlr4ng';
|
||||
|
||||
describe('trino SQL Visitor Tests', () => {
|
||||
const expectTableName = 'user1';
|
||||
const sql = `select id,name,sex from ${expectTableName};`;
|
||||
const parser = new TrinoSQL();
|
||||
const trino = new TrinoSQL();
|
||||
|
||||
const parseTree = parser.parse(sql, (error) => {
|
||||
const parseTree = trino.parse(sql, (error) => {
|
||||
console.error('Parse error:', error);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user