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

Stu Hood commented on AVRO-603:
-------------------------------

> but DataFileReader should reset the actual schema from the file.
In this case, we're doing serialization directly rather than with data files.

The easiest example I can give is the patch to our utility functions on 
CASSANDRA-1351: I assumed that the parameter to SpecificDatumReader(Schema) was 
the writers schema, since the readers schema is readily available with an 
instance of the generic object. Instead, that patch converts our utility 
functions to get the readers schema from an instance of the object.

> Probably we should update javadocs for GenericDatumReader to define expected 
> as reader's and actual as writer's.
Yea, changing the javadocs for Specific/GenericDatumReader would probably be a 
sufficient solution. Also, adding a constructor for SpecificDatumReader that 
takes both readers and writers would help.

I can make a quick patch to do this.

> SpecificDatumReader requires the reader's schema to be set manually
> -------------------------------------------------------------------
>
>                 Key: AVRO-603
>                 URL: https://issues.apache.org/jira/browse/AVRO-603
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Stu Hood
>            Priority: Minor
>
> Since SpecificDatumReader has actual objects with schemas attached to them, 
> it would seem that you wouldn't need to set the reader's schema: the default 
> constructor only takes one schema argument, so it seems to support this, but 
> behind the scenes, it sets the readers/writers to the same schema.
> Additionally, since DatumReader and its implementations use the terms 
> 'expected' and 'actual' to refer to the 'reader' and 'writer' schemas, 
> determining that you need to set the reader's schema requires a code dive, 
> rather than a glance at the javadocs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to