what is the code for WritableComparator.readVInt and WritableUtils.decodeVIntSize doing?

2012-03-30 Thread Jane Wayne
in tom white's book, Hadoop, The Definitive Guide, in the second edition, on page 99, he shows how to compare the raw bytes of a key with Text fields. he shows an example like the following. int firstL1 = WritableUtils.decodeVIntSize(b1[s1]) + readVInt(b1, s1); int firstL2 = WritableUtils.decodeVI

Re: what is the code for WritableComparator.readVInt and WritableUtils.decodeVIntSize doing?

2012-03-31 Thread Chris White
A text object is written out as a vint representing the number of bytes and then the byte array contents of the text object Because a vintage can be between 1-5 bytes in length, the decodeVIntSize method examines the first byte of the vint to work out how many bytes to skip over before the text by

Re: what is the code for WritableComparator.readVInt and WritableUtils.decodeVIntSize doing?

2012-03-31 Thread Jane Wayne
chris, thanks. i see now. internally, i use String instead of Text and so I use WritableUtils.writeString(...) and not Text.write(...). in the latter method, i see that it calls WritableUtils.writeVInt(...) before out.write(byte[], start, length). tom white uses Text internally to represent stri