drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinfengni <...@git.apache.org>
Subject [GitHub] drill pull request: Drill 4372 review
Date Wed, 16 Mar 2016 23:42:48 GMT
Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/397#discussion_r56435145
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java
---
    @@ -64,4 +108,47 @@ public boolean isDeterministic() {
       public List<DrillFuncHolder> getFunctions() {
         return functions;
       }
    +
    +  public static class DrillSqlOperatorBuilder {
    +    private String name;
    +    private final List<DrillFuncHolder> functions = Lists.newArrayList();
    +    private int argCountMin = Integer.MAX_VALUE;
    +    private int argCountMax = Integer.MIN_VALUE;
    +    private boolean isDeterministic = true;
    +
    +    public DrillSqlOperatorBuilder setName(final String name) {
    +      this.name = name;
    +      return this;
    +    }
    +
    +    public DrillSqlOperatorBuilder addFunctions(Collection<DrillFuncHolder> functions)
{
    +      this.functions.addAll(functions);
    +      return this;
    +    }
    +
    +    public DrillSqlOperatorBuilder setArgumentCount(final int argCountMin, final int
argCountMax) {
    +      this.argCountMin = Math.min(this.argCountMin, argCountMin);
    +      this.argCountMax = Math.max(this.argCountMax, argCountMax);
    +      return this;
    +    }
    +
    +    public DrillSqlOperatorBuilder setDeterministic(boolean isDeterministic) {
    +      if(this.isDeterministic) {
    +        this.isDeterministic = isDeterministic;
    +      }
    +      return this;
    +    }
    +
    +    public DrillSqlOperator build() {
    +      return new DrillSqlOperator(
    +          name,
    +          functions,
    +          argCountMin,
    +          argCountMax,
    +          isDeterministic,
    +          TypeInferenceUtils.getDrillSqlReturnTypeInference(
    +              name,
    --- End diff --
    
    Can we ensure that name and functions are always set, before call this constructor this
builder? If not, will it hit problem?



---
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