hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo (Nicholas), SZE (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-5596) Make ObjectWritable support EnumSet
Date Wed, 29 Apr 2009 02:05:30 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703953#action_12703953

Tsz Wo (Nicholas), SZE commented on HADOOP-5596:

> We only force an EnumSet not be none when it is serialized.
Since EnumSetWritable is in org.apache.hadoop.io package, we have to make sure it works for
all kind of EnumSet, including empty set.

> If it is not ok. how about this, we require the elementType when we serialize a non enumset?
if the elementType is not provided, we throw an exception.
This is one possible solution.  Then, we should enforce the status that either both elementType
and value are null, or both are not null.

More comments on the patch:
- check null before accessing value in equals(..), hashCode(), toString(), etc.  Otherwise,
there are NPE.
- Similarly, check null for conf.
- need more tests for EnumSetWritable.  The current test does not use EnumSetWritable at all.
- minimize the usage of @SuppressWarnings("unchecked").  We should fix the generic syntax
but not suppressing the warnings.

> Make ObjectWritable support EnumSet
> -----------------------------------
>                 Key: HADOOP-5596
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5596
>             Project: Hadoop Core
>          Issue Type: Improvement
>          Components: io
>            Reporter: He Yongqiang
>            Assignee: He Yongqiang
>         Attachments: Hadoop-5596-2009-03-31.patch, Hadoop-5596-2009-04-03.patch, Hadoop-5596-2009-04-15-2.patch,
Hadoop-5596-2009-04-15.patch, Hadoop-5596-2009-04-24.patch
> This is a demand for Hadoop-5438. 
> Also another small improvement is that i saw that in the beginning of readObject, it
tries to get the class from PRIMITIVE_NAMES and then conf. Maybe it is better to add a direct
load after them if the delaredClass is still null. Like this:
> {code}
> String className = UTF8.readString(in);
>     Class<?> declaredClass = PRIMITIVE_NAMES.get(className);
>     if (declaredClass == null) {
>       try {
>         declaredClass = conf.getClassByName(className);
>       } catch (Exception e) {
>       }
>     }
>     if(declaredClass == null) {
>       try {
>         declaredClass = Class.forName(className);
>       } catch (ClassNotFoundException e) {
>         throw new RuntimeException("readObject can't find class " + className, e);
>       }
>     }
> {code}

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

View raw message