test: hivesql drop syntax unit tests
This commit is contained in:
parent
6f7a59775c
commit
af1c640c9d
@ -4,15 +4,20 @@ import { readSQL } from '../../../helper';
|
||||
const parser = new HiveSQL();
|
||||
|
||||
const features = {
|
||||
indexes: readSQL(__dirname, 'dropIndex.sql'),
|
||||
drops: readSQL(__dirname, 'drop.sql'),
|
||||
reloads: readSQL(__dirname, 'reload.sql')
|
||||
};
|
||||
|
||||
describe('Hive Drop Syntax Tests', () => {
|
||||
describe('DROP INDEX', () => {
|
||||
features.indexes.forEach((index) => {
|
||||
it(index, () => {
|
||||
expect(parser.validate(index).length).toBe(0);
|
||||
});
|
||||
features.drops.forEach((drop) => {
|
||||
it(drop, () => {
|
||||
expect(parser.validate(drop).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
features.reloads.forEach((reload) => {
|
||||
it(reload, () => {
|
||||
expect(parser.validate(reload).length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
41
test/parser/hive/syntax/fixtures/drop.sql
Normal file
41
test/parser/hive/syntax/fixtures/drop.sql
Normal file
@ -0,0 +1,41 @@
|
||||
-- Drop Database
|
||||
DROP SCHEMA schema1 ;
|
||||
|
||||
DROP DATABASE IF EXISTS mydb1 RESTRICT;
|
||||
|
||||
DROP DATABASE IF EXISTS mydb1 CASCADE;
|
||||
|
||||
-- Drop Connector
|
||||
DROP CONNECTOR connector1;
|
||||
|
||||
DROP CONNECTOR IF EXISTS connector1;
|
||||
|
||||
-- Drop View
|
||||
DROP VIEW view1;
|
||||
|
||||
DROP VIEW IF EXISTS mydb1.view2;
|
||||
|
||||
DROP MATERIALIZED VIEW materialized_view_name;
|
||||
|
||||
-- Drop Table
|
||||
DROP TABLE tb1;
|
||||
|
||||
DROP TABLE IF EXISTS db1.tb2 PURGE;
|
||||
|
||||
-- Drop Macro
|
||||
DROP TEMPORARY MACRO macro1;
|
||||
|
||||
DROP TEMPORARY MACRO IF EXISTS macro2;
|
||||
|
||||
-- Drop Role
|
||||
DROP ROLE `admin`;
|
||||
|
||||
-- Drop Index
|
||||
DROP INDEX table01_index ON table01;
|
||||
|
||||
DROP INDEX IF EXISTS table02_index ON table02;
|
||||
|
||||
-- Drop Function
|
||||
DROP FUNCTION func1;
|
||||
|
||||
DROP FUNCTION IF EXISTS func2;
|
@ -1,3 +0,0 @@
|
||||
DROP INDEX table01_index ON table01;
|
||||
|
||||
DROP INDEX IF EXISTS table02_index ON table02;
|
3
test/parser/hive/syntax/fixtures/reload.sql
Normal file
3
test/parser/hive/syntax/fixtures/reload.sql
Normal file
@ -0,0 +1,3 @@
|
||||
RELOAD FUNCTION;
|
||||
|
||||
RELOAD FUNCTIONS;
|
Loading…
Reference in New Issue
Block a user