DonnyZone commented on a change in pull request #706: [CALCITE-2302] Implicit 
type cast support
URL: https://github.com/apache/calcite/pull/706#discussion_r317437128
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystem.java
 ##########
 @@ -132,11 +132,19 @@ RelDataType deriveCovarType(RelDataTypeFactory 
typeFactory,
    * @return the result type for a decimal addition.
    */
   default RelDataType deriveDecimalPlusType(RelDataTypeFactory typeFactory,
-                                            RelDataType type1, RelDataType 
type2) {
+      RelDataType type1, RelDataType type2) {
     if (SqlTypeUtil.isExactNumeric(type1)
             && SqlTypeUtil.isExactNumeric(type2)) {
       if (SqlTypeUtil.isDecimal(type1)
               || SqlTypeUtil.isDecimal(type2)) {
+        // Java numeric will always have invalid precision/scale,
+        // use its default decimal precision/scale instead.
+        type1 = RelDataTypeFactoryImpl.isJavaType(type1)
 
 Review comment:
   Hi, @danny0405. Maybe we also need to handle `deriveDecimalMultiplyType` and 
`deriveDecimalDivideType` in this class. I wait for your fix here to complete 
CALCITE-3245.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to