885b85e842
* feat: add showIndex parser rule * test: uncomment show index test cases * test: add unit tests about DML syntax to HiveSQL * test: add unit tests about export and import syntax to HiveSQL * refactor: recompile hive grammar * test: correct description of HiveSQL unit tests
21 lines
753 B
TypeScript
21 lines
753 B
TypeScript
import HiveSQL from '../../../src/parser/hive';
|
|
|
|
describe('HiveSQL Syntax Tests', () => {
|
|
const parser = new HiveSQL();
|
|
test('Create Table Statement', () => {
|
|
const sql = 'CREATE TABLE person(name STRING,age INT);';
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(0);
|
|
});
|
|
test('Create Table Statement', () => {
|
|
const sql = `alter table dm_gis.table_name add if not exists partition (inc_day = '20190601');`;
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(0);
|
|
});
|
|
test('Wrong Select Statement', () => {
|
|
const sql = 'SELECT add ABC FROM WHERE;';
|
|
const result = parser.validate(sql);
|
|
expect(result.length).toBe(1);
|
|
});
|
|
});
|