Github user hsuanyi commented on a diff in the pull request: https://github.com/apache/drill/pull/397#discussion_r56456844 --- 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) { --- End diff -- I think we had this discussion on the review procedure before. Say, in the Collection<DrillFuncHolder> we have some DrillFuncHolder which are deterministic and the other are non-deterministic. By the logic here, we will group the entire Collection<DrillFuncHolder> as a DrillSqlOperator and claim it is non-deterministic. In fact, separating them into two DrillSqlOperator (one being deterministic and the other being non-deterministic does not help). Please see DrillOperatorTable.lookupOperatorOverloads(). As you can see, parameter list is not passed in. So even if we have two DrillSqlOperator, DrillOperatorTable.lookupOperatorOverloads() does not have the enough information to pick the one.
--- 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. ---