mapreduce - TSV input in Hadoop Map Reduce -
i'm trying run simple map cut down operation tsv dataset , i'm bit confused goes wrong when i'm trying simple map operation. next modification of sample word count problem of map class.
public static class map extends mapreducebase implements mapper<longwritable, text, text, intwritable> { private text node = new text(); public void map(longwritable key, text value, outputcollector<text, intwritable> output, reporter reporter) throws ioexception { string line = value.tostring(); string tokens[] = line.split('t'); node.set(tokens[1]); int weight = integer.parseint(tokens[2]); output.collect(node, new writable(weight)); } } the input can visualized tsv file having 3 columns. error method.java.lang.string.split beingness not applicable above code in line line split tokens. ideas may going wrong?
string tokens[] = line.split('t');
change to
string tokens[] = line.split('\t');
hadoop mapreduce
No comments:
Post a Comment