private void testInsertOverwrite(HiveStatement stmt) throws SQLException {
    String tblName = "testInsertOverwriteExecAsync";
    try {
      int rowCount = 0;
      stmt.execute("create table " + tblName + " (col1 int , col2 string)");
      boolean isResulSet =
          stmt.executeAsync("insert overwrite table " + tblName + " select * from " + tableName);
      assertFalse(isResulSet);
      // HiveStatement#getUpdateCount blocks until the async query is complete
      rowCount = stmt.getUpdateCount();
      // Read from the new table
      ResultSet rs = stmt.executeQuery("select * from " + tblName);
      assertNotNull(rs);
      while (rs.next()) {
        String value = rs.getString(2);
        assertNotNull(value);
      }
      assertEquals(dataFileRowCount, rowCount);
    } finally {
      stmt.execute("drop table " + tblName);
    }
  }
Test {@link HiveStatement#executeAsync(String)} for an insert overwrite into a table
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java