Github user hsuanyi commented on a diff in the pull request:
https://github.com/apache/drill/pull/377#discussion_r53561067
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java
---
@@ -18,69 +18,81 @@
package org.apache.drill.exec.planner.sql;
-import com.google.common.base.Preconditions;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.common.types.TypeProtos.MinorType;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.calcite.avatica.util.TimeUnit;
+import org.apache.calcite.sql.SqlIntervalQualifier;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlFunction;
import org.apache.calcite.sql.SqlFunctionCategory;
import org.apache.calcite.sql.SqlIdentifier;
import org.apache.calcite.sql.SqlOperatorBinding;
import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.sql.validate.SqlValidator;
-import org.apache.calcite.sql.validate.SqlValidatorScope;
+
+import org.apache.drill.common.expression.DumbLogicalExpression;
+import org.apache.drill.common.expression.ExpressionPosition;
+import org.apache.drill.common.expression.FunctionCall;
+import org.apache.drill.common.expression.LogicalExpression;
+import org.apache.drill.common.types.TypeProtos.MajorType;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.common.types.Types;
+import
org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
+import org.apache.drill.exec.expr.fn.DrillFuncHolder;
+import org.apache.drill.exec.planner.logical.DrillConstExecutor;
+import org.apache.drill.exec.resolver.FunctionResolver;
+import org.apache.drill.exec.resolver.FunctionResolverFactory;
public class DrillSqlOperator extends SqlFunction {
- static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(DrillSqlOperator.class);
+ // static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(DrillSqlOperator.class);
private static final MajorType NONE = MajorType.getDefaultInstance();
- private final MajorType returnType;
private final boolean isDeterministic;
+ private final List<DrillFuncHolder> functions;
+ @Deprecated
public DrillSqlOperator(String name, int argCount, boolean
isDeterministic) {
- this(name, argCount, MajorType.getDefaultInstance(), isDeterministic);
+ this(name, null, argCount, isDeterministic);
}
- public DrillSqlOperator(String name, int argCount, MajorType returnType,
boolean isDeterminisitic) {
- super(new SqlIdentifier(name, SqlParserPos.ZERO),
DynamicReturnType.INSTANCE, null, new Checker(argCount), null,
SqlFunctionCategory.USER_DEFINED_FUNCTION);
- this.returnType = Preconditions.checkNotNull(returnType);
- this.isDeterministic = isDeterminisitic;
+ public DrillSqlOperator(String name, int argCount, MajorType returnType,
boolean isDeterministic) {
+ super(new SqlIdentifier(name, SqlParserPos.ZERO),
+ null,
--- End diff --
1. Why do you pass null as SqlReturnTypeInference?
Since Calcite's inference mechanism is not going to be used in Drill at
all, those three fields do not have practical meaning.
2. Why do you put the logic for returnTypeInference in a static method in
TypeInferenceUtils?
Does make sense. I addressed it in the new patch.
---
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.
---