wombatu-kun commented on code in PR #20566:
URL: https://github.com/apache/hudi/pull/20566#discussion_r4523262358
##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/util/TypeConverters.java:
##########
@@ -160,7 +170,7 @@ public Object convert(Object val) {
@Override
public Object convert(Object val) {
- return toDecimalData(Double.parseDouble(val.toString()), toType);
+ return toDecimalData(new BigDecimal(val.toString()), toType);
Review Comment:
`new BigDecimal(String)` rejects the leading/trailing whitespace that
`Double.parseDouble` trims, so a padded value such as `" 1.5"` now fails the
read with a `NumberFormatException` instead of converting. Should this trim
first, as `SparkInternalSchemaConverter.convertStringType` does (`new
BigDecimal(val.toString().trim())`), with a padded-input case in
`TestTypeConverters`?
--
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]