deniskuzZ commented on code in PR #5920:
URL: https://github.com/apache/hive/pull/5920#discussion_r2184967740


##########
ql/src/test/org/apache/hadoop/hive/ql/schq/TestScheduledQueryStatements.java:
##########
@@ -203,6 +206,67 @@ public void testAlter() throws ParseException, Exception {
 
   }
 
+  @Test
+  public void testDrop() throws ParseException, Exception {
+    IDriver driver = createDriver();
+
+    driver.run("set role admin");
+    driver.run("create scheduled query drop1 cron '0 0 7 * * ? *' as select 1 
from tu");
+    driver.run("drop scheduled query drop1");
+
+    try (CloseableObjectStore os = new 
CloseableObjectStore(env_setup.getTestCtx().hiveConf)) {
+      Optional<MScheduledQuery> sq = os.getMScheduledQuery(new 
ScheduledQueryKey("drop1", "hive"));
+      assertFalse(sq.isPresent());
+    }
+  }
+
+  @Test
+  public void testDropIfExists() throws ParseException, Exception {
+    IDriver driver = createDriver();
+
+    driver.run("set role admin");
+    driver.run("create scheduled query drop2 cron '0 0 7 * * ? *' as select 1 
from tu");
+    driver.run("drop scheduled query if exists drop2");
+
+    try (CloseableObjectStore os = new 
CloseableObjectStore(env_setup.getTestCtx().hiveConf)) {
+      Optional<MScheduledQuery> sq = os.getMScheduledQuery(new 
ScheduledQueryKey("drop2", "hive"));
+      assertFalse(sq.isPresent());
+    }
+  }
+
+  @Test
+  public void testDropWithoutCreate() throws ParseException, Exception, 
SemanticException {
+    IDriver driver = createDriver();
+    driver.run("set role admin");
+    driver.run("drop scheduled query drop3");

Review Comment:
   would be nice to validate the error code and msg as well



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to