@Override
  public QueryResult executeQuery(String sql, ParserRuleContext ctx) {
    try {
      Map<String, String> confOverlay = new HashMap<>();
      confOverlay.put(QUERY_EXECUTOR, HPLSQL);
      OperationHandle operationHandle = hiveSession.executeStatement(sql, confOverlay);
      return new QueryResult(new OperationRowResult(operationHandle), () -> metadata(operationHandle), null);
    } catch (HiveSQLException e) {
      return new QueryResult(null, () -> new Metadata(Collections.emptyList()), e);
    }
  }
Executing HiveQL from HPL/SQL directly, without JDBC or Thrift.
service/src/java/org/apache/hive/service/cli/operation/hplsql/HplSqlQueryExecutor.java