@Override
  public ASTNode preAnalyze(HiveSemanticAnalyzerHookContext context, ASTNode ast) throws SemanticException {
    int type = ast.getType();
    switch (type) {
    case HiveParser.TOK_CREATE_SCHEDULED_QUERY:
      registerCreated(ast.getChild(0).getText());
    }

    return super.preAnalyze(context, ast);
  }
This hook helps to do some cleanup after tests are creating scheduled queries.
ql/src/test/org/apache/hadoop/hive/ql/hooks/ScheduledQueryCreationRegistryHook.java