Github user hsuanyi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/377#discussion_r53561382
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillExtractConvertlet.java
 ---
    @@ -51,17 +53,38 @@ public RexNode convertCall(SqlRexContext cx, SqlCall 
call) {
         final List<RexNode> exprs = new LinkedList<>();
     
         RelDataTypeFactory typeFactory = cx.getTypeFactory();
    -
    -    //RelDataType nullableReturnType =
    -
         for (SqlNode node: operands) {
            exprs.add(cx.convertExpression(node));
         }
    +    TimeUnit timeUnit = ((SqlIntervalQualifier) 
call.getOperandList().get(0)).getStartUnit();
    +    boolean isNullable = exprs.get(1).getType().isNullable();
    +    RelDataType returnType = inferReturnType(typeFactory, timeUnit, 
isNullable);
    +    return rexBuilder.makeCall(returnType, call.getOperator(), exprs);
    +  }
     
    -    // Determine NULL-able using 2nd argument's Null-able.
    -    RelDataType returnType = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 exprs.get(1).getType().isNullable());
    +  public static RelDataType inferReturnType(RelDataTypeFactory factory, 
TimeUnit timeUnit, boolean isNullable) {
    --- End diff --
    
    This static method is used in another place too. But I think it makes more 
sense to put it to TypeInferenceUtils. Thanks for bringing my attention to this 
one.
    
    Addressed


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

Reply via email to