markap14 commented on a change in pull request #3724: NIFI-6640 - UNION/CHOICE
types not handled correctly
URL: https://github.com/apache/nifi/pull/3724#discussion_r324281234
##########
File path:
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java
##########
@@ -225,17 +232,109 @@ public static boolean isCompatibleDataType(final Object
value, final DataType da
}
public static DataType chooseDataType(final Object value, final
ChoiceDataType choiceType) {
- for (final DataType subType : choiceType.getPossibleSubTypes()) {
- if (isCompatibleDataType(value, subType)) {
- if (subType.getFieldType() == RecordFieldType.CHOICE) {
- return chooseDataType(value, (ChoiceDataType) subType);
- }
+ Queue<DataType> possibleSubTypes = new
LinkedList<>(choiceType.getPossibleSubTypes());
Review comment:
Is there a reason to use a Queue/LinkedList here? I think this should just
be an ArrayList and iterate over the values, rather than using `peek` & `poll`
----------------------------------------------------------------
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