in src/main/java/com/aliyun/odps/jdbc/utils/transformer/to/jdbc/ToJdbcBigDecimalTransformer.java [34:62]
public Object transform(Object o, String charset) throws SQLException {
if (o == null) {
return null;
}
try {
if (o instanceof BigDecimal) {
return o;
} else if (o instanceof Number || o instanceof String || o instanceof AbstractChar) {
return new BigDecimal(o.toString().trim());
} else if (o instanceof Binary) {
String str = encodeBytes(((Binary) o).data(), charset);
return new BigDecimal(str);
} else if (o instanceof byte[]) {
String str = encodeBytes((byte[]) o, charset);
return new BigDecimal(str);
} else {
String errorMsg = getInvalidTransformationErrorMsg(o.getClass(), BigDecimal.class);
throw new SQLException(errorMsg);
}
} catch (SQLException e) {
throw e;
} catch (Exception e) {
String
errorMsg =
getTransformationErrMsg(Objects.toString(o), BigDecimal.class, e.getMessage());
throw new SQLException(errorMsg, e);
}
}