avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1199) SortedKeyValueFile$Writer.append method have a puzzle for the sorted key
Date Thu, 08 Nov 2012 17:22:12 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493314#comment-13493314
] 

Doug Cutting commented on AVRO-1199:
------------------------------------

Yes, this looks like a bug that we should fix.

A simpler way to fix it might be to change this to:

mPreviousKey = GenericData.get().deepCopy(mKeySchema, key);

Would you like to prepare a patch for this?

https://cwiki.apache.org/AVRO/how-to-contribute.html
                
> SortedKeyValueFile$Writer.append method have a puzzle for the sorted key
> ------------------------------------------------------------------------
>
>                 Key: AVRO-1199
>                 URL: https://issues.apache.org/jira/browse/AVRO-1199
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.3
>            Reporter: Libing Sun
>              Labels: patch
>
> At the SortedKeyValueFile.java 539 lines like next:
> mPreviousKey = key;
> This class is same as Hadoop's MapFile, at the MapFile the same methon will keep a copy
for this key, but not use "=".
> If use "=" at here, when user append a reuse key object to this file. will cause key
sorted not valid.
> I think next code will fix it:
> private DataInputBuffer inBuf = new DataInputBuffer();
> private DataOutputBuffer outBuf = new DataOutputBuffer();
>       GenericDatumWriter<K> writer = new ReflectDatumWriter<K>(schema);
>       GenericDatumReader<K> reader = new ReflectDatumReader<K>(schema);
>       writer.write(key, encoder);
>       inBuf.reset(outBuf.getData(), outBuf.getLength());
>       BinaryDecoder decoder = DecoderFactory.get().directBinaryDecoder(inBuf,
>           null);
>       lastKey = reader.read(null, decoder); 

--
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

Mime
View raw message