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

    https://github.com/apache/drill/pull/1232#discussion_r184031285
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/TypeInferenceUtils.java
 ---
    @@ -382,13 +407,26 @@ public RelDataType inferReturnType(SqlOperatorBinding 
opBinding) {
     
           final RelDataType operandType = opBinding.getOperandType(0);
           final TypeProtos.MinorType inputMinorType = 
getDrillTypeFromCalciteType(operandType);
    -      
if(TypeCastRules.getLeastRestrictiveType(Lists.newArrayList(inputMinorType, 
TypeProtos.MinorType.BIGINT))
    +      if 
(TypeCastRules.getLeastRestrictiveType(Lists.newArrayList(inputMinorType, 
TypeProtos.MinorType.BIGINT))
               == TypeProtos.MinorType.BIGINT) {
             return createCalciteTypeWithNullability(
                 factory,
                 SqlTypeName.BIGINT,
                 isNullable);
    -      } else 
if(TypeCastRules.getLeastRestrictiveType(Lists.newArrayList(inputMinorType, 
TypeProtos.MinorType.FLOAT8))
    +      } else if 
(TypeCastRules.getLeastRestrictiveType(Lists.newArrayList(inputMinorType, 
TypeProtos.MinorType.FLOAT4))
    --- End diff --
    
    Thanks, added an explanation for sum and avg return type inferences.


---

Reply via email to