private void testSelect(HiveStatement stmt) throws SQLException {
    // Expected row count of the join query we'll run
    int expectedCount = 1028;
    int rowCount = 0;
    boolean isResulSet =
        stmt.executeAsync("select t1.value as v11, " + "t2.value as v12 from " + tableName
            + " t1 join " + tableName + " t2 on t1.under_col = t2.under_col");
    assertTrue(isResulSet);
    ResultSet rs = stmt.getResultSet();
    assertNotNull(rs);
    // ResultSet#next blocks until the async query is complete
    while (rs.next()) {
      String value = rs.getString(2);
      rowCount++;
      assertNotNull(value);
    }
    assertEquals(rowCount, expectedCount);
  }
Test {@link HiveStatement#executeAsync(String)} for a select query
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java