private RowSet fetch() {
      try {
        return hiveSession.fetchResults(
                handle, FetchOrientation.FETCH_NEXT, fetchSize, FetchType.QUERY_OUTPUT);
      } catch (HiveSQLException e) {
        throw new QueryException(e);
      }
    }
Executing HiveQL from HPL/SQL directly, without JDBC or Thrift.
service/src/java/org/apache/hive/service/cli/operation/hplsql/HplSqlQueryExecutor.java