drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hnfgns <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-4132 Ability to submit simple type of ph...
Date Wed, 27 Apr 2016 22:12:41 GMT
Github user hnfgns commented on a diff in the pull request:

    https://github.com/apache/drill/pull/368#discussion_r61345892
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java ---
    @@ -321,6 +329,38 @@ public void close() {
         return listener.getResults();
       }
     
    +  public DrillRpcFuture<QueryPlanFragments> planQuery(QueryType type, String query,
boolean isSplitPlan) {
    +    GetQueryPlanFragments runQuery = GetQueryPlanFragments.newBuilder().setQuery(query).setType(type).setSplitPlan(isSplitPlan).build();
    +    return client.submitPlanQuery(runQuery);
    +  }
    +
    +  public void runQuery(QueryType type, List<PlanFragment> planFragments, UserResultsListener
resultsListener)
    +      throws RpcException {
    +    // QueryType can be only executional
    +    checkArgument((QueryType.EXECUTION == type), "Only EXECUTIONAL type query is supported
with PlanFragments");
    +    // setting Plan on RunQuery will be used for logging purposes and therefore can not
be null
    +    // since there is no Plan string provided we will create a JsonArray out of individual
fragment Plans
    +    ArrayNode jsonArray = objectMapper.createArrayNode();
    +    for (PlanFragment fragment : planFragments) {
    +      try {
    +        jsonArray.add(objectMapper.readTree(fragment.getFragmentJson()));
    +      } catch (IOException e) {
    +        logger.error("Exception while trying to read PlanFragment JSON for %s", fragment.getHandle().getQueryId(),
e);
    +        throw new RpcException(e);
    +      }
    +    }
    +    final String fragmentsToJsonString;
    +    try {
    +      fragmentsToJsonString = objectMapper.writeValueAsString(jsonArray);
    --- End diff --
    
    why don't we create & serialize List<String> instead of relying on ArrayNode?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message