Esempio n. 1
0
  public boolean updateQuery(String tql) throws ServiceException {
    QueryRequest.Builder builder = QueryRequest.newBuilder();
    builder.setQuery(tql);

    ResultCode resultCode = service.updateQuery(null, builder.build()).getResultCode();
    return resultCode == ResultCode.OK;
  }
Esempio n. 2
0
  /**
   * It submits a query statement and get a response. The main difference from {@link
   * #executeQuery(String)} is a blocking method. So, this method is wait for the finish of the
   * submitted query.
   *
   * @return If failed, return null.
   */
  public ResultSet executeQueryAndGetResult(String tql) throws ServiceException, IOException {
    QueryRequest.Builder builder = QueryRequest.newBuilder();
    builder.setQuery(tql);
    SubmitQueryRespose response = service.submitQuery(null, builder.build());
    QueryId queryId = new QueryId(response.getQueryId());
    if (queryId.equals(TajoIdUtils.NullQueryId)) {
      return null;
    }

    return getQueryResultAndWait(queryId);
  }
Esempio n. 3
0
  /**
   * It submits a query statement and get a response immediately. The response only contains a query
   * id, and submission status. In order to get the result, you should use {@link
   * #getQueryResult(tajo.QueryId)} or {@link #getQueryResultAndWait(tajo.QueryId)}.
   */
  public SubmitQueryRespose executeQuery(String tql) throws ServiceException {
    QueryRequest.Builder builder = QueryRequest.newBuilder();
    builder.setQuery(tql);

    return service.submitQuery(null, builder.build());
  }