gideonkorir commented on a change in pull request #3343: Nifi 5572
URL: https://github.com/apache/nifi/pull/3343#discussion_r294937124
##########
File path:
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java
##########
@@ -1378,6 +1393,61 @@ public static boolean isCharacterTypeCompatible(final
Object value) {
return value != null && (value instanceof Character || (value
instanceof CharSequence && ((CharSequence) value).length() > 0));
}
+ public static BigDecimal toDecimal(final Object value, final String
fieldName) {
+ if (value == null) {
+ return null;
+ }
+
+ if (value instanceof BigDecimal) {
+ return (BigDecimal)value;
+ }
+
+ if (value instanceof String) {
+ return new BigDecimal((String) value);
+ }
+
+ if(value instanceof Number){
+ return new BigDecimal(((Number)value).doubleValue());
+ }
+
Review comment:
Good feedback, will add that
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services