test: hivesql schedule query ddl syntax unit tests

This commit is contained in:
hayden 2023-07-10 10:37:19 +08:00
parent faabeffe8a
commit 13e52f50f7
4 changed files with 21 additions and 2 deletions

View File

@ -9,6 +9,7 @@ const features = {
tables: readSQL(__dirname, 'alterTable.sql'),
indexes: readSQL(__dirname, 'alterIndex.sql'),
views: readSQL(__dirname, 'alterView.sql'),
scheduleQueries: readSQL(__dirname, 'alterScheduleQuery.sql'),
};
describe('Hive Alter Syntax Tests', () => {
@ -51,4 +52,12 @@ describe('Hive Alter Syntax Tests', () => {
});
});
});
describe('ALTER SCHEDULE QUERY', () => {
features.scheduleQueries.forEach((sq) => {
it(sq, () => {
expect(parser.validate(sq).length).toBe(0);
});
});
});
});

View File

@ -0,0 +1,7 @@
ALTER SCHEDULED QUERY sq_1 EVERY HOUR AT '0:07:30';
ALTER SCHEDULED QUERY sq_2 EXECUTED AS 'user2';
ALTER SCHEDULED QUERY sq_3 DISABLED;
ALTER SCHEDULED QUERY sq_4 AS SELECT * FROM tbl1;

View File

@ -9,12 +9,12 @@ AS ANALYZE TABLE t
CREATE SCHEDULED QUERY s_day
EVERY 2 DAY OFFSET BY 'offsetTs'
EXECUTED AS 'SELECT * FROM aa'
EXECUTED AS 'admin'
ENABLE
DEFINED AS INSERT INTO t VALUES (1);
CREATE SCHEDULED QUERY s_hour
EVERY HOUR AT '0:07:30'
EXECUTED AS 'SELECT * FROM aa'
EXECUTED AS 'query_user_1'
DISABLE
DEFINED AS INSERT INTO t VALUES (1);

View File

@ -39,3 +39,6 @@ DROP INDEX IF EXISTS table02_index ON table02;
DROP FUNCTION func1;
DROP FUNCTION IF EXISTS func2;
-- Drop Schedule Query
DROP SCHEDULED QUERY sq_1;