@Test
  public void testGetQueryId() throws Exception {
    HiveStatement stmt = (HiveStatement) con.createStatement();
    HiveStatement stmt1 = (HiveStatement) con.createStatement();

    // Returns null if no query is running.
    String queryId = stmt.getQueryId();
    assertTrue(queryId == null);

    stmt.executeAsync("create database query_id_test with dbproperties ('repl.source.for' = '1, 2, 3')");
    queryId = stmt.getQueryId();
    assertFalse(queryId.isEmpty());
    stmt.getUpdateCount();

    stmt1.executeAsync("repl status query_id_test with ('hive.query.id' = 'hiveCustomTag')");
    String queryId1 = stmt1.getQueryId();
    assertNotEquals("hiveCustomTag", queryId1);
    assertNotEquals(queryId, queryId1);
    assertFalse(queryId1.isEmpty());
    stmt1.getUpdateCount();

    stmt.executeAsync("select count(*) from " + dataTypeTableName);
    queryId = stmt.getQueryId();
    assertNotEquals("hiveCustomTag", queryId);
    assertFalse(queryId.isEmpty());
    assertNotEquals(queryId, queryId1);
    stmt.getUpdateCount();

    stmt.execute("drop database query_id_test");
    stmt.close();
    stmt1.close();
  }
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