Vote count:
0
I am writing a mapreduce code and my intermediate mapper output key is a Text version of ArrayWritable and i have created a class TextArrayWritable and extended ArrayWritable.Below is my code
public class TextArrayWritable extends ArrayWritable {
//private Writable[] values;
public TextArrayWritable()
{
super(Text.class);
}
public TextArrayWritable(String[] strings)
{
super(Text.class);
Text[] texts=new Text[strings.length];
for(int i=0;i<strings.length;i++)
{
texts[i]=new Text(strings[i]);
}
set(texts);
}
public String[] returnarray(Text[] mytext)
{
//super(Text.class);
String[] mystr=new String[mytext.length];
//ArrayList<String> mylist=new ArrayList<String>();
for(int i=0;i<mystr.length;i++)
{
mystr[i]=mystr[i].toString();
}
return mystr;
}
public Text[] toArray() {
return (Text[]) super.toArray();
}
}
How to write a compareTo() method for the above class i understand it needs to implemented by implementing WritableComparable interface but not sure how to write a method.
asked 52 secs ago
How to write a compareTo() method for Text version of arrywritable
Aucun commentaire:
Enregistrer un commentaire