public void run(SessionState sess, Set<ReadEntity> inputs,
      Set<WriteEntity> outputs, UserGroupInformation ugi, boolean isExplain)
    throws Exception {

    // Don't enforce during test driver setup or shutdown.
    if (sess.getConf().getBoolean("hive.test.init.phase", false) ||
        sess.getConf().getBoolean("hive.test.shutdown.phase", false)) {
      return;
    }
    List<String> readOnlyTables = Arrays.asList(System.getProperty("test.src.tables").split(","));

    for (WriteEntity w: outputs) {
      if ((w.getTyp() == WriteEntity.Type.TABLE) ||
          (w.getTyp() == WriteEntity.Type.PARTITION)) {
        Table t = w.getTable();
        if (DEFAULT_DATABASE_NAME.equalsIgnoreCase(t.getDbName())
            && readOnlyTables.contains(t.getTableName()) && !isExplain) {
          throw new RuntimeException ("Cannot overwrite read-only table: " + t.getTableName());
        }
      }
    }
  }
Implementation of a pre execute hook that prevents modifications
of read-only tables used by the test framework
ql/src/java/org/apache/hadoop/hive/ql/hooks/EnforceReadOnlyTables.java