[
https://issues.apache.org/jira/browse/PIG-2645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13456967#comment-13456967
]
Shami B commented on PIG-2645:
------------------------------
Thanks Alex. The fix can be implemented as :
if (s == null) {
throw new IllegalArgumentException("InputSplits must implement Writable.");
} else {
s.open((OutputStream) os);
}
> PigSplit does not handle the case where SerializationFactory returns null
> -------------------------------------------------------------------------
>
> Key: PIG-2645
> URL: https://issues.apache.org/jira/browse/PIG-2645
> Project: Pig
> Issue Type: Bug
> Components: impl
> Reporter: Alex Levenson
>
> In PigSplit.java, line 254:
> {code}
> SerializationFactory sf = new SerializationFactory(conf);
> Serializer s = sf.getSerializer(wrappedSplits[0].getClass());
> s.open((OutputStream) os);
> {code}
> sf.getSerializer returns null when it cannot find a serializer for a given
> object. Instead of handling this properly, a NPE is thrown when s.open() is
> called.
> This is easy to encounter when creating a custom InputSplit from the
> mapreduce package which is an abstract class that DOES NOT implement Writable.
> However it's easy to miss because InputSplit from the mapred package is an
> interface that extends Writable, and InputSplits often both extend and
> implement both the new and old InputSplit abstract class and interface
> (thereby becoming Writable).
--
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