You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by bora <bo...@hotmail.com> on 2010/01/07 23:45:22 UTC

Custom Writer truncates output after some big number

http://old.nabble.com/file/p27068391/ReachSum.java ReachSum.java 

Hi
I have a problem printing one of my hadoop outputs. I have a class where I
hold the output data
See below. It gets collected at the reducer
SummaryOut so; ...
output.collect(new StringArrayWritable(key.content), so);
But when the number is large it truncates a digit. The 11th digit. I am
pretty sure long handles much bigger then this digit. So why would I see the
value truncated? Any ideas?
It goes crazy somewhere between this number 4,470,397,148 and the
10,000,000,000
Thanks for your helps.


public static class SummaryOut implements Writable {
public long idedViews = 0;
public long idedUsers = 0;
public long allViews = 0;
public long allUsers = 0;


public void write(DataOutput out) throws IOException {
out.writeLong(idedViews);
out.writeLong(idedUsers);
out.writeLong(allViews);
out.writeLong(allUsers);
}

public void readFields(DataInput in) throws IOException {
idedViews = in.readLong();
idedUsers = in.readLong();
allViews = in.readLong();
allUsers = in.readLong();
}

public static SummaryOut read(DataInput in) throws IOException {
SummaryOut s = new SummaryOut();
s.readFields(in);
return s;
}

public String toString() {
return "" + idedUsers + '\t' + idedViews + '\t' + allUsers + '\t' +
allViews;
}
} 
-- 
View this message in context: http://old.nabble.com/Custom-Writer-truncates-output-after-some-big-number-tp27068391p27068391.html
Sent from the Hadoop core-user mailing list archive at Nabble.com.