diff --git a/test/parser/hive/syntax/alterStatement.test.ts b/test/parser/hive/syntax/alterStatement.test.ts index ca5599a1..b319d744 100644 --- a/test/parser/hive/syntax/alterStatement.test.ts +++ b/test/parser/hive/syntax/alterStatement.test.ts @@ -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); + }); + }); + }); }); diff --git a/test/parser/hive/syntax/fixtures/alterScheduleQuery.sql b/test/parser/hive/syntax/fixtures/alterScheduleQuery.sql new file mode 100644 index 00000000..d545165b --- /dev/null +++ b/test/parser/hive/syntax/fixtures/alterScheduleQuery.sql @@ -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; diff --git a/test/parser/hive/syntax/fixtures/createScheduledQuery.sql b/test/parser/hive/syntax/fixtures/createScheduledQuery.sql index a1a8ae29..d5e54375 100644 --- a/test/parser/hive/syntax/fixtures/createScheduledQuery.sql +++ b/test/parser/hive/syntax/fixtures/createScheduledQuery.sql @@ -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); diff --git a/test/parser/hive/syntax/fixtures/drop.sql b/test/parser/hive/syntax/fixtures/drop.sql index 01450021..b84630ce 100644 --- a/test/parser/hive/syntax/fixtures/drop.sql +++ b/test/parser/hive/syntax/fixtures/drop.sql @@ -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; \ No newline at end of file