@Override
  public ResultSet executeQuery(String sql) throws SQLException {
    if (!execute(sql)) {
      throw new SQLException("The query did not generate a result set");
    }
    return resultSet;
  }
Close statement if needed, and reset the flags.
@throws SQLException
jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java