Qing Wang created AVRO-2270:
-------------------------------

             Summary: Can not set non-null default value for Auto generated 
Arvo Schema with field include null type
                 Key: AVRO-2270
                 URL: https://issues.apache.org/jira/browse/AVRO-2270
             Project: Apache Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.8.2
            Reporter: Qing Wang


Auto generated Avro schema with fields have union type including null, can not 
be assigned to a non-null default value. The reason is Avro set null as the 
first type in the union .see [the source code 
|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java]
  line 694   // add null as the first type in a new union.

Based on the [Avro doc|[https://avro.apache.org/docs/1.8.1/spec.html#Unions],] 
the type of the default value must match the _first_ element of the union. 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to