tpalfy 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_r324785019
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/schema/inference/FieldTypeInference.java
 ##########
 @@ -62,36 +62,44 @@ public void addPossibleDataType(final DataType dataType) {
             final RecordSchema newSchema = ((RecordDataType) 
dataType).getChildSchema();
 
             final RecordSchema mergedSchema = 
DataTypeUtils.merge(singleDataTypeSchema, newSchema);
+            possibleDataTypes.remove(singleDataType);
             singleDataType = 
RecordFieldType.RECORD.getRecordDataType(mergedSchema);
+            possibleDataTypes.add(singleDataType);
             return;
         }
 
-        if (singleFieldType.isWiderThan(additionalFieldType)) {
-            // Assigned type is already wide enough to encompass the given type
-            return;
+        if (possibleDataTypes.isEmpty()) {
+            possibleDataTypes.add(singleDataType);
         }
 
-        if (additionalFieldType.isWiderThan(singleFieldType)) {
-            // The given type is wide enough to encompass the assigned type. 
So changed the assigned type to the given type.
-            singleDataType = dataType;
-            return;
-        }
+        boolean hasWiderNonString = possibleDataTypes.stream()
 
 Review comment:
   Replaced Stream api usage.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to