You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Jeffrey Theobald (JIRA)" <ji...@apache.org> on 2012/11/05 05:55:12 UTC

[jira] [Commented] (AVRO-1183) Avro Pair fails to initialize when either they key or value is a list.

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

Jeffrey Theobald commented on AVRO-1183:
----------------------------------------

Ahh, of course.  We've been using that pair constructor to get around the exception but now that you've pointed it out why it won't work, it makes sense.  Thank you for clearing that up.

Is it possible that the error message could be a little more descriptive? I'm not sure what the convention is for these kinds of exceptions within the Avro project but I'm sure I'm not the only one who's bumped into this issue. The current exception message is technically correct but it's very minimal which is slightly confusing.
                
> Avro Pair fails to initialize when either they key or value is a list.
> ----------------------------------------------------------------------
>
>                 Key: AVRO-1183
>                 URL: https://issues.apache.org/jira/browse/AVRO-1183
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Jeffrey Theobald
>            Priority: Minor
>
> Hello,
> It seems that a change somewhere between 1.5.7 and 1.7.2 (maybe AVRO-966 ?) has broken the Avro Pair object, so that you can no longer instantiate a pair when either the key or the value is a list.
> To replicate this bug, try the following:
> {code}
> Integer key = new Integer(0);
> List<Integer> list = new ArrayList<Integer>();
> Pair<Integer, List<Integer>> pair = new Pair<Integer, List<Integer>>(key, list);
> {code}
> It will produce something like the following exception:
> {noformat}org.apache.avro.AvroRuntimeException: Can't find element type of Collection
> 	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:281)
> 	at org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:151)
> 	at org.apache.avro.mapred.Pair.<init>(Pair.java:312)
>         .....SNIP.....
> {noformat}
> I've used Integer here for illustration but it also affects SpecificRecord objects.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira