drill-dev mailing list archives

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

    https://github.com/apache/drill/pull/397#discussion_r56431148
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlAggOperator.java
---
    @@ -17,47 +17,76 @@
      */
     package org.apache.drill.exec.planner.sql;
     
    -import java.util.List;
    -
    -import org.apache.calcite.rel.type.RelDataType;
    -import org.apache.calcite.rel.type.RelDataTypeFactory;
    +import com.google.common.collect.Lists;
     import org.apache.calcite.sql.SqlAggFunction;
    -import org.apache.calcite.sql.SqlCall;
     import org.apache.calcite.sql.SqlFunctionCategory;
     import org.apache.calcite.sql.SqlIdentifier;
     import org.apache.calcite.sql.SqlKind;
     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.calcite.sql.type.SqlReturnTypeInference;
    +import org.apache.drill.exec.expr.fn.DrillFuncHolder;
     
    -import com.google.common.collect.ImmutableList;
    +import java.util.Collection;
    +import java.util.List;
     
     public class DrillSqlAggOperator extends SqlAggFunction {
    -  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillSqlAggOperator.class);
    +  // private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillSqlAggOperator.class);
    +  private final List<DrillFuncHolder> functions;
     
    -
    -  public DrillSqlAggOperator(String name, int argCount) {
    -    super(name, new SqlIdentifier(name, SqlParserPos.ZERO), SqlKind.OTHER_FUNCTION, DynamicReturnType.INSTANCE,
null, new Checker(argCount), SqlFunctionCategory.USER_DEFINED_FUNCTION);
    +  protected DrillSqlAggOperator(String name, List<DrillFuncHolder> functions, int
argCountMin, int argCountMax, SqlReturnTypeInference sqlReturnTypeInference) {
    +    super(name,
    +        new SqlIdentifier(name, SqlParserPos.ZERO),
    +        SqlKind.OTHER_FUNCTION,
    +        sqlReturnTypeInference,
    +        null,
    +        Checker.getChecker(argCountMin, argCountMax),
    +        SqlFunctionCategory.USER_DEFINED_FUNCTION);
    +    this.functions = functions;
       }
     
    -  @Override
    -  public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall
call) {
    -    return getAny(validator.getTypeFactory());
    +  private DrillSqlAggOperator(String name, List<DrillFuncHolder> functions, int
argCountMin, int argCountMax) {
    +    this(name,
    +        functions,
    +        argCountMin,
    +        argCountMax,
    +        TypeInferenceUtils.getDrillSqlReturnTypeInference(
    +            name,
    +            functions));
       }
     
    -  private RelDataType getAny(RelDataTypeFactory factory){
    -    return factory.createSqlType(SqlTypeName.ANY);
    -//    return new RelDataTypeDrillImpl(new RelDataTypeHolder(), factory);
    +  public List<DrillFuncHolder> getFunctions() {
    +    return functions;
       }
     
    -//  @Override
    -//  public List<RelDataType> getParameterTypes(RelDataTypeFactory typeFactory)
{
    -//    return ImmutableList.of(typeFactory.createSqlType(SqlTypeName.ANY));
    -//  }
    -//
    -//  @Override
    -//  public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
    -//    return getAny(typeFactory);
    -//  }
    +  public static class DrillSqlAggOperatorBuilder {
    +    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;
    --- End diff --
    
    unused?


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