Github user sudheeshkatkam commented on a diff in the pull request:

    https://github.com/apache/drill/pull/530#discussion_r73942324
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java ---
    @@ -512,6 +526,61 @@ public void runQuery(QueryType type, 
List<PlanFragment> planFragments, UserResul
       }
     
       /**
    +   * Create a prepared statement for given <code>query</code>.
    +   *
    +   * @param query
    +   * @return
    +   */
    +  public DrillRpcFuture<CreatePreparedStatementResp> 
createPreparedStatement(final String query) {
    +    final CreatePreparedStatementReq req =
    +        CreatePreparedStatementReq.newBuilder()
    +            .setSqlQuery(query)
    +            .build();
    +
    +    return client.send(RpcType.CREATE_PREPARED_STATEMENT, req, 
CreatePreparedStatementResp.class);
    +  }
    +
    +  /**
    +   * Execute the given prepared statement.
    +   *
    +   * @param preparedStatementHandle Prepared statement handle returned in 
response to
    +   *                                {@link 
#createPreparedStatement(String)}.
    +   * @param resultsListener {@link UserResultsListener} instance for 
listening for query results.
    +   */
    +  public void executePreparedStatement(final PreparedStatementHandle 
preparedStatementHandle,
    +      final UserResultsListener resultsListener) {
    +    final RunQuery runQuery = newBuilder()
    +        .setResultsMode(STREAM_FULL)
    +        .setType(QueryType.PREPARED_STATEMENT)
    +        .setPreparedStatementHandle(preparedStatementHandle)
    +        .build();
    +    client.submitQuery(resultsListener, runQuery);
    +  }
    +
    +  /**
    +   * Execute the given prepared statement and return the results.
    +   *
    +   * @param preparedStatementHandle Prepared statement handle returned in 
response to
    +   *                                {@link 
#createPreparedStatement(String)}.
    +   * @return List of {@link QueryDataBatch}s. It is responsibility of the 
caller to release query data batches.
    +   * @throws RpcException
    +   */
    +  public List<QueryDataBatch> executePreparedStatement(final 
PreparedStatementHandle preparedStatementHandle)
    --- End diff --
    
    VisibleForTesting annotation?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to