[
https://issues.apache.org/jira/browse/HADOOP-10898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14077538#comment-14077538
]
Eli Acherkan commented on HADOOP-10898:
---------------------------------------
Test case:
Let CustomWritableA and CustomWritableB be 2 custom implementations of Writable.
1. (Acting as a producer of data) Create a MapWritable. Add an instance of
CustomWritableA as a key or a value. Write the MapWritable to a data stream.
2. Create another MapWritable. Add an instance of CustomWritableB. Write the
MapWritable to the same data stream.
3. (As a consumer of the data stream) Create a separate MapWritable instance
and read from the data stream. The instance is correctly populated with
CustomWritableA.
4. Now, attempt to reuse the MapWritable instance and read again from the data
stream. The instance should be populated with CustomWritableB, but the actual
result is an IllegalArgumentException: "Id 1 exists but maps to CustomWritableA
and not CustomWritableB".
> MapWritable instances cannot be reused when containing different custom
> Writable classes.
> -----------------------------------------------------------------------------------------
>
> Key: HADOOP-10898
> URL: https://issues.apache.org/jira/browse/HADOOP-10898
> Project: Hadoop Common
> Issue Type: Bug
> Components: io
> Reporter: Eli Acherkan
> Priority: Minor
>
> When a data stream contains several MapWritable instances, which contain
> instances of several different custom classes (implementing Writable),
> attempting to reuse a single MapWritable instance for reading the data stream
> results in an IllegalArgumentException. This happens because
> AbstractMapWritable.readFields doesn't reset the classToIdMap/idToClassMap
> data structures.
--
This message was sent by Atlassian JIRA
(v6.2#6252)