Skip to content

Commit db0f417

Browse files
committed
Informative error for BigDecimal conversion in JdbcIO.
1 parent 0228419 commit db0f417

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/LogicalTypes.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,13 @@ private FixedPrecisionNumeric(
265265

266266
@Override
267267
public BigDecimal toInputType(BigDecimal base) {
268-
checkArgument(base == null || (base.precision() == precision && base.scale() == scale));
268+
checkArgument(
269+
base == null || (base.precision() == precision && base.scale() == scale),
270+
"Expected BigDecimal base to be null or have precision = %s (was %s), scale = %s (was %s)",
271+
precision,
272+
base.precision(),
273+
scale,
274+
base.scale());
269275
return base;
270276
}
271277
}

0 commit comments

Comments
 (0)