MAPREDUCE-5995. native-task: Revert changes to Text internals. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/MR-2841@1613828 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
43917e564d
commit
78d86a9839
|
@ -226,10 +226,6 @@ public class Text extends BinaryComparable
|
|||
this.length = len;
|
||||
}
|
||||
|
||||
public void setLength(int len) {
|
||||
this.length = len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a range of bytes to the end of the given text
|
||||
* @param utf8 the data to copy from
|
||||
|
@ -264,7 +260,7 @@ public class Text extends BinaryComparable
|
|||
* @param len the number of bytes we need
|
||||
* @param keepData should the old data be kept
|
||||
*/
|
||||
public void setCapacity(int len, boolean keepData) {
|
||||
private void setCapacity(int len, boolean keepData) {
|
||||
if (bytes == null || bytes.length < len) {
|
||||
if (bytes != null && keepData) {
|
||||
bytes = Arrays.copyOf(bytes, Math.max(len,length << 1));
|
||||
|
|
|
@ -7,3 +7,4 @@ MAPREDUCE-5996. native-task: Rename system tests into standard directory layout
|
|||
MAPREDUCE-5997. native-task: Use DirectBufferPool from Hadoop Common (todd)
|
||||
MAPREDUCE-6000. native-task: Simplify ByteBufferDataReader/Writer (todd)
|
||||
MAPREDUCE-5991. native-task should not run unit tests if native profile is not enabled. (Binglin Chang)
|
||||
MAPREDUCE-5995. native-task: Revert changes to Text internals (todd)
|
||||
|
|
|
@ -42,13 +42,6 @@ public class TextSerializer implements INativeSerializer<Text>, INativeComparabl
|
|||
|
||||
@Override
|
||||
public void deserialize(DataInput in, int length, Text w) throws IOException {
|
||||
try {
|
||||
w.setCapacity(length, true);
|
||||
w.setLength(length);
|
||||
} catch (final Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
final byte[] bytes = w.getBytes();
|
||||
in.readFully(bytes, 0, length);
|
||||
w.readWithKnownLength(in, length);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue