Github user twalthr commented on a diff in the pull request: https://github.com/apache/flink/pull/5212#discussion_r159393961 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/ScalarOperators.scala --- @@ -47,9 +47,22 @@ object ScalarOperators { nullCheck: Boolean, resultType: TypeInformation[_], left: GeneratedExpression, - right: GeneratedExpression) - : GeneratedExpression = { - val leftCasting = numericCasting(left.resultType, resultType) + right: GeneratedExpression): GeneratedExpression = { + + val leftCasting = operator match { + case "%" => + if (left.resultType == right.resultType) { + numericCasting(left.resultType, resultType) + } else { + val castedType = if (isDecimal(left.resultType)) { + Types.LONG --- End diff -- Wouldn't it be better to use `BigDecimal. remainder` instead of losing precision?
---