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

    https://github.com/apache/drill/pull/489#discussion_r62084962
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/TypeInferenceUtils.java
 ---
    @@ -734,6 +772,41 @@ public static FunctionCall 
convertSqlOperatorBindingToFunctionCall(final SqlOper
       }
     
       /**
    +   * Based on whether decimal type is supported or not, this method 
creates an ExplicitOperatorBinding which interprets
    +   * the type of decimal literals accordingly.
    +   */
    +  public static SqlOperatorBinding convertDecimalLiteralToDouble(final 
SqlOperatorBinding sqlOperatorBinding, final boolean isDecimalSupported) {
    +    final List<RelDataType> types = Lists.newArrayList();
    +    for(int i = 0; i < sqlOperatorBinding.getOperandCount(); ++i) {
    +      final RelDataType relDataType;
    +      if(isDecimalLiteral(sqlOperatorBinding, i) && !isDecimalSupported) {
    +        relDataType = createCalciteTypeWithNullability(
    +            sqlOperatorBinding.getTypeFactory(),
    +            SqlTypeName.DOUBLE,
    +            sqlOperatorBinding.getOperandType(i).isNullable());
    +      } else {
    +        relDataType = sqlOperatorBinding.getOperandType(i);
    +      }
    +      types.add(relDataType);
    +    }
    +    return new 
ExplicitOperatorBinding(sqlOperatorBinding.getTypeFactory(), 
sqlOperatorBinding.getOperator(), types);
    --- End diff --
    
    Here we do not have to return a new OperatorBinding. In case there is no 
Decimal -> Double replacement, why can't we return the old binding directly? 


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