jcamachor commented on a change in pull request #794: HIVE-21884
URL: https://github.com/apache/hive/pull/794#discussion_r331673021
 
 

 ##########
 File path: itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
 ##########
 @@ -266,6 +285,25 @@ public void clearKeysCreatedInTests() {
     }
   }
 
+  public void clearScheduledQueries() {
+    if (System.getenv(QTEST_LEAVE_FILES) != null) {
+      return;
+    }
+    Set<String> scheduledQueries = 
ScheduledQueryCreationRegistryHook.getSchedules();
+    for (String name : scheduledQueries) {
+      ScheduledQueryMaintenanceRequest request = new 
ScheduledQueryMaintenanceRequest();
+      request.setType(ScheduledQueryMaintenanceRequestType.DELETE);
+      ScheduledQuery schq = new ScheduledQuery();
+      schq.setScheduleKey(new ScheduledQueryKey(name, 
conf.getVar(ConfVars.HIVE_SCHEDULED_QUERIES_NAMESPACE)));
+      request.setScheduledQuery(schq);
+      try {
+        db.getMSC().scheduledQueryMaintenance(request);
+      } catch (Exception e) {
+        LOG.error("Cant remove scheduled query: " + name + " " + 
e.getMessage());
 
 Review comment:
   Typo: `Cant`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to