mattyb149 commented on a change in pull request #3424: NIFI-6096: Fixed 
ValidateRecord handling of nested maps
URL: https://github.com/apache/nifi/pull/3424#discussion_r273626697
 
 

 ##########
 File path: 
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java
 ##########
 @@ -736,7 +736,7 @@ public static Object convertRecordFieldtoObject(final 
Object value, final DataTy
     }
 
     public static boolean isMapTypeCompatible(final Object value) {
-        return value != null && value instanceof Map;
+        return value != null && (value instanceof Map || value instanceof 
MapRecord);
 
 Review comment:
   This feels a little hacky to me, but the alternative was to refactor a bunch 
of code that validates record fields, so we could instead validate map entries. 
It would also entail changing the JSON Reader(s) (at the least) to generate 
Maps instead of MapRecords as it does now. So I'm checking specifically for 
MapRecord (not Record) to say that it's compatible with a MAP type, which is 
consistent with the example schema and data (a MapRecord is created but the 
type is MAP\<STRING\>).

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

Reply via email to