2023-07-07 11:19:28 +08:00
|
|
|
import HiveSQL from '../../../../src/parser/hive';
|
|
|
|
import { readSQL } from '../../../helper';
|
|
|
|
|
|
|
|
const parser = new HiveSQL();
|
|
|
|
|
|
|
|
const features = {
|
2023-07-07 17:04:37 +08:00
|
|
|
databases: readSQL(__dirname, 'alterDatabase.sql'),
|
|
|
|
connectors: readSQL(__dirname, 'alterConnector.sql'),
|
|
|
|
tables: readSQL(__dirname, 'alterTable.sql'),
|
2023-07-07 11:19:28 +08:00
|
|
|
indexes: readSQL(__dirname, 'alterIndex.sql'),
|
2023-07-07 17:04:37 +08:00
|
|
|
views: readSQL(__dirname, 'alterView.sql'),
|
2023-07-10 10:37:19 +08:00
|
|
|
scheduleQueries: readSQL(__dirname, 'alterScheduleQuery.sql'),
|
2023-07-07 11:19:28 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
describe('Hive Alter Syntax Tests', () => {
|
2023-07-07 17:04:37 +08:00
|
|
|
describe('ALTER DATABASE', () => {
|
|
|
|
features.databases.forEach((db) => {
|
|
|
|
it(db, () => {
|
|
|
|
expect(parser.validate(db).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('ALTER CONNECTOR', () => {
|
|
|
|
features.connectors.forEach((ctors) => {
|
|
|
|
it(ctors, () => {
|
|
|
|
expect(parser.validate(ctors).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('ALTER TABLE', () => {
|
|
|
|
features.tables.forEach((tb) => {
|
|
|
|
it(tb, () => {
|
|
|
|
expect(parser.validate(tb).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-07-07 11:19:28 +08:00
|
|
|
describe('ALTER INDEX', () => {
|
|
|
|
features.indexes.forEach((index) => {
|
|
|
|
it(index, () => {
|
|
|
|
expect(parser.validate(index).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2023-07-07 17:04:37 +08:00
|
|
|
|
|
|
|
describe('ALTER VIEW', () => {
|
|
|
|
features.views.forEach((view) => {
|
|
|
|
it(view, () => {
|
|
|
|
expect(parser.validate(view).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2023-07-10 10:37:19 +08:00
|
|
|
|
|
|
|
describe('ALTER SCHEDULE QUERY', () => {
|
|
|
|
features.scheduleQueries.forEach((sq) => {
|
|
|
|
it(sq, () => {
|
|
|
|
expect(parser.validate(sq).length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2023-07-07 11:19:28 +08:00
|
|
|
});
|