You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/11/05 23:42:23 UTC

[GitHub] [nifi] markap14 commented on a change in pull request #4648: NIFI-7981 - add support for enum type in avro schema

markap14 commented on a change in pull request #4648:
URL: https://github.com/apache/nifi/pull/4648#discussion_r518437335



##########
File path: nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java
##########
@@ -1025,6 +1029,17 @@ public static boolean isStringTypeCompatible(final Object value) {
         return value != null;
     }
 
+    public static boolean isEnumTypeCompatible(final Object value, final EnumDataType enumType) {
+        return enumType.getEnums() != null && enumType.getEnums().contains(value);
+    }
+
+    private static Object toEnum(Object value, EnumDataType dataType, String fieldName) {
+        if(dataType.getEnums() != null && dataType.getEnums().contains(value)) {

Review comment:
       We should be very careful here - there is no spec. We absolutely do not - and should not - follow the Avro spec. We should do what makes sense for us. Personally I am not a fan of introducing Enums at all. I very intentionally didn't add those in as a data type when we created the initial set.  More on that in a general comment below :)




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