Home > other >  Hadoop map of how to read in vectorwritable type
Hadoop map of how to read in vectorwritable type

Time:09-26

Public class UserVectorToCooccurrenceMapper extends
Mapper {

Public void map (VarLongWritable userID, VectorWritable userVector,
The Context Context) throws IOException, InterruptedException {
Iterator It=userVector. The get (). IterateNonZero ();
While (it. HasNext ()) {
Int index1=it. Next (). The index ();
Iterator It2=userVector. The get (). IterateNonZero ();
While (it2. HasNext ()) {
Int index2=it2. Next (). The index ();
The context. Write (new IntWritable (index1), new IntWritable (index2));
}
}
}
VectorWritable how to receive here
  • Related