Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in WritableUtils.fromWritable() - incorrect ArrayWritable to List handling #37

Closed
tzolov opened this issue Apr 19, 2013 · 3 comments

Comments

@tzolov
Copy link

tzolov commented Apr 19, 2013

The ArrayWritable to List transformation does not return the result list but falls back to the byte array:

       else if (writable instanceof ArrayWritable) {
            Writable[] writables = ((ArrayWritable) writable).get();
            List<Object> list = new ArrayList<Object>(writables.length);
            for (Writable wrt : writables) {
                list.add(fromWritable(wrt));
            }
+            return list;
        }
....
        // fall-back to bytearray
        return org.apache.hadoop.io.WritableUtils.toByteArray(writable);
}
@tzolov
Copy link
Author

tzolov commented Apr 19, 2013

just pushed a fix along with a test #38

@tzolov
Copy link
Author

tzolov commented Apr 19, 2013

haven't test it but seems like this issue could cause #36 as well.

@costin costin closed this as completed in 48358d6 Apr 19, 2013
@costin
Copy link
Member

costin commented Apr 19, 2013

Thanks for the report - it was spot on. I've added some unit tests as well to double check the rest of the conversion (which looks okay).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants