[
https://issues.apache.org/jira/browse/AVRO-1183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495080#comment-13495080
]
Jeffrey Theobald commented on AVRO-1183:
----------------------------------------
Yeah, that seems more helpful. Would it be too verbose to go even further and
suggest the remedy in the exception message? i.e.,_ "Cannot infer schema for
Collection. Specify the schema for Pairs containing Collections to avoid this
error"_. Again, I'm not sure of the Avro convention is, but either way works
for me.
> 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