Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/565#discussion_r82266904
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java ---
    @@ -688,4 +802,142 @@ public DrillBuf getBuffer() {
           return null;
         }
       }
    +
    +  /**
    +   * Return a new {@link DrillClient.Builder Drill client builder}.
    +   * @return a new builder
    +   */
    +  public static Builder newBuilder() {
    +    return new Builder();
    +  }
    +
    +  /**
    +   * Helper class to construct a {@link DrillClient Drill client}.
    +   */
    +  public static class Builder {
    +
    +    private DrillConfig config;
    +    private BufferAllocator allocator;
    +    private ClusterCoordinator clusterCoordinator;
    +    private EventLoopGroup eventLoopGroup;
    +    private ExecutorService executor;
    +
    +    // defaults
    +    private boolean supportComplexTypes = true;
    +    private boolean isDirectConnection = false;
    +
    +    /**
    +     * Sets the {@link DrillConfig configuration} for this client.
    +     *
    +     * @param drillConfig drill configuration
    +     * @return this builder
    +     */
    +    public Builder setConfig(DrillConfig drillConfig) {
    +      this.config = drillConfig;
    +      return this;
    +    }
    +
    +    /**
    +     * Sets the {@link DrillConfig configuration} for this client based on 
the given file.
    +     *
    +     * @param fileName configuration file name
    +     * @return this builder
    +     */
    +    public Builder setConfigFromFile(final String fileName) {
    +      this.config = DrillConfig.create(fileName);
    +      return this;
    +    }
    +
    +    /**
    +     * Sets the {@link BufferAllocator buffer allocator} to be used by 
this client.
    +     * If this is not set, an allocator will be created based on the 
configuration.
    --- End diff --
    
    But, what if I don't provide a config? Or, create my own? What do I have to 
set in that config to make it work?
    
    More to the point, WHEN do I have to provide my own root? When I do 
multiple clients in a single app? If so, can we provide a short example showing 
how this works?
    
    Even easier, can the builder itself create a static allocator that it 
shares across connections?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to