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

    https://github.com/apache/flink/pull/2870#discussion_r103736499
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/codegen/calls/ScalarOperators.scala
 ---
    @@ -1002,12 +1068,17 @@ object ScalarOperators {
         val resultTypeTerm = primitiveTypeTermForTypeInfo(resultType)
         // no casting necessary
         if (operandType == resultType) {
    -      (operandTerm) => s"$operandTerm"
    +      if (isDecimal(operandType)) {
    +        (operandTerm) => s"$operandTerm.stripTrailingZeros()"
    +      } else {
    +        (operandTerm) => s"$operandTerm"
    +      }
         }
         // result type is decimal but numeric operand is not
         else if (isDecimal(resultType) && !isDecimal(operandType) && 
isNumeric(operandType)) {
           (operandTerm) =>
    -        s"java.math.BigDecimal.valueOf((${superPrimitive(operandType)}) 
$operandTerm)"
    +        s"java.math.BigDecimal.valueOf((${superPrimitive(operandType)}) 
$operandTerm)" +
    --- End diff --
    
    @twalthr See my comment above


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