vitaly-ivanov commented on a change in pull request #15987:
URL: https://github.com/apache/beam/pull/15987#discussion_r751993295



##########
File path: 
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/LogicalTypes.java
##########
@@ -266,8 +266,8 @@ private FixedPrecisionNumeric(
     @Override
     public BigDecimal toInputType(BigDecimal base) {
       checkArgument(
-          base == null || (base.precision() == precision && base.scale() == 
scale),
-          "Expected BigDecimal base to be null or have precision = %s (was 
%s), scale = %s (was %s)",
+          base == null || (base.precision() <= precision && base.scale() <= 
scale),

Review comment:
       I think we can add smth like
   ```java
   base == null || (base.precision() <= precision && base.scale() <= scale)
                 // for cases when received values can be safely coerced to the 
schema 
                 || base.round(new MathContext(precision)).compareTo(base) == 0
   ```
   I suppose, the first condition will be enough for the vast majority of 
cases, when the second one will be executed for negative cases and cases when 
values can be safely coerced to the schema.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to