[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Priority: Trivial  (was: Major)

> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Trivial
>




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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: (was: Auto generated Avro schema with fields have union 
type including null, can not be assigned to a non-null type 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"]. Due to the issue mentioned above, we can not 
set a default value with desired type.)

> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>




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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"]. In which case we can not set a default value 
with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

{"type": ["null", "desired type"]}  In which case we can not set a default 
value with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> "type": ["null", "desired type"]. In which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

{"type": ["null", "desired type"]}.  In which case we can not set a default 
value with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

{"type": ["null", "desired type"]}, in which case we can not set a default 
value with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> {"type": ["null", "desired type"]}.  In which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
Auto generated Avro schema with fields have union type including null, can not 
be assigned to a non-null type 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"]. Due to the issue mentioned above, we can not 
set a default value with desired type.

  was:
Auto generated Avro schema with fields have union type including null, can not 
be assigned to a non-null type 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"], in which case we can not set a default value 
with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> Auto generated Avro schema with fields have union type including null, can 
> not be assigned to a non-null type 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> "type": ["null", "desired type"]. Due to the issue mentioned above, we can 
> not set a default value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
Auto generated Avro schema with fields have union type including null, can not 
be assigned to a non-null type 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"], in which case we can not set a default value 
with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"], in which case we can not set a default value 
with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> Auto generated Avro schema with fields have union type including null, can 
> not be assigned to a non-null type 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> "type": ["null", "desired type"], in which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"], in which case we can not set a default value 
with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

"type": ["null", "desired type"]. In which case we can not set a default value 
with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> "type": ["null", "desired type"], in which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

{"type": ["null", "desired type"]}  In which case we can not set a default 
value with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

{"type": ["null", "desired type"]}.  In which case we can not set a default 
value with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> {"type": ["null", "desired type"]}  In which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Summary: Can not set non-null type default value for auto generated Arvo 
schema with fields have null type  (was: Can not set non-null default value for 
Auto generated Arvo Schema with field include null type)

> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
>  
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> \{"type": ["null", "desired type"]}, in which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  
{"type": ["null", "desired type"]}, in which case we can not set a default 
value with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  
\{"type": ["null", "desired type"]}, in which case we can not set a default 
value with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> {"type": ["null", "desired type"]}, in which case we can not set a default 
> value with desired type.



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


[jira] [Updated] (AVRO-2270) Can not set non-null type default value for auto generated Arvo schema with fields have null type

2018-11-16 Thread Qing Wang (JIRA)


 [ 
https://issues.apache.org/jira/browse/AVRO-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qing Wang updated AVRO-2270:

Description: 
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  

{"type": ["null", "desired type"]}, in which case we can not set a default 
value with desired type.

  was:
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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, the 
type of the default value must match the _first_ element of the union. 

Not very clear what is the reasons for this design. But in our use case, we 
want some fields to be non mandatory,  the auto generated schema would be  
{"type": ["null", "desired type"]}, in which case we can not set a default 
value with desired type.


> Can not set non-null type default value for auto generated Arvo schema with 
> fields have 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
>Priority: Major
>
> 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 [https://avro.apache.org/docs/1.8.1/spec.html#Unions], in a union, 
> the type of the default value must match the _first_ element of the union. 
> Not very clear what is the reasons for this design. But in our use case, we 
> want some fields to be non mandatory,  the auto generated schema would be  
> {"type": ["null", "desired type"]}, in which case we can not set a default 
> value with desired type.



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