[ 
https://issues.apache.org/jira/browse/AVRO-1954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15792686#comment-15792686
 ] 

ASF GitHub Bot commented on AVRO-1954:
--------------------------------------

GitHub user nandorKollar opened a pull request:

    https://github.com/apache/avro/pull/180

    AVRO-1954 - Schema.Field.defaultVal() generates: Unknown datum type 
org.apache.avro.JsonProperties$Null

    Added the test cases in the patch attached to AVRO-1954 Jira to 
TestGenericDatumWriter (since the issue is related to GenericDatumWriter), and 
modified GenericData to map JsonProperties.NULL_VALUE to Type.NULL

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nandorKollar/avro AVRO-1954

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/avro/pull/180.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #180
    
----
commit 25635e1fdd66d7275abe7e65e288f3c4ee078d97
Author: Nandor Kollar <nkol...@cloudera.com>
Date:   2017-01-02T11:00:34Z

    AVRO-1954 - Schema.Field.defaultVal() generates: Unknown datum type 
org.apache.avro.JsonProperties$Null

----


> Schema.Field.defaultVal() generates: Unknown datum type 
> org.apache.avro.JsonProperties$Null
> -------------------------------------------------------------------------------------------
>
>                 Key: AVRO-1954
>                 URL: https://issues.apache.org/jira/browse/AVRO-1954
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.1, 1.9.0
>            Reporter: rui miranda
>            Assignee: Nandor Kollar
>            Priority: Minor
>         Attachments: unitTestDefaultNull.patch
>
>
> I was creating GenericRecords and populating some fields -- which i could not 
> find the content on some json files -- with the Schema.Field.defaultVal(). 
> It seems if the schema has explicitly set the default value to be null, the 
> records generated this way can't be written. In this case, if default value 
> is null in the schema, an instance of 
> org.apache.avro.JsonProperties.NULL_VALUE is returned by 
> Schema.Field.defaultVal().
> I created an unit test which replicates the bug. I was thinking modify the 
> class org.apache.avro.generic.GenericData to evaluate 
> org.apache.avro.JsonProperties.NULL_VALUE as null. Is this the way to go? or 
> org.apache.avro.JsonProperties.NULL_VALUE is intend for other purposes?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to