You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Qing Wang (JIRA)" <ji...@apache.org> on 2018/11/16 13:07:00 UTC

[jira] [Created] (AVRO-2270) Can not set non-null default value for Auto generated Arvo Schema with field include null type

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)