Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.IntWritable


  @Override
  protected void reduce(Text artist,
                        Iterable<IntWritable> values,
                        Context context) throws IOException,
                                        InterruptedException {
    context.write(artist, new IntWritable(0));
  }
View Full Code Here


  public void map(VarLongWritable key, VectorWritable value, Context context)
      throws IOException, InterruptedException {
    long userID = key.get();
    Vector userVector = value.get();
    Iterator<Vector.Element> it = userVector.iterateNonZero();
    IntWritable itemIndexWritable = new IntWritable();
    while (it.hasNext()) {
      Vector.Element e = it.next();
      int itemIndex = e.index();
      float preferenceValue = (float) e.get();
      itemIndexWritable.set(itemIndex);
      context.write(itemIndexWritable,
          new VectorOrPrefWritable(userID, preferenceValue));
    }
  }
View Full Code Here

    while (it.hasNext()) {
      int index1 = it.next().index();
      Iterator<Vector.Element> it2 = userVector.get().iterateNonZero();
      while (it2.hasNext()) {
        int index2 = it2.next().index();
        context.write(new IntWritable(index1), new IntWritable(index2));
      }
    }
  }
View Full Code Here

      new TanimotoDistanceMeasure(), 0.01, 20, 2.0f, true, true, 0.0, false);
   
    SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path(
      clusterOutput + Cluster.CLUSTERED_POINTS_DIR +"/part-m-00000"), conf);
   
    IntWritable key = new IntWritable();
    WeightedVectorWritable value = new WeightedVectorWritable();
    while (reader.next(key, value)) {
      System.out.println("Cluster: " + key.toString() + " "
                         + value.getVector().asFormatString());
    }
    reader.close();
  }
View Full Code Here

      20, true, false);
   
    SequenceFile.Reader reader = new SequenceFile.Reader(fs,
        new Path(clusterOutput + Cluster.CLUSTERED_POINTS_DIR + "/part-00000"), conf);
   
    IntWritable key = new IntWritable();
    WeightedVectorWritable value = new WeightedVectorWritable();
    while (reader.next(key, value)) {
       System.out.println(key.toString() + " belongs to cluster "
       + value.toString());
    }
    reader.close();
  }
View Full Code Here

   
    SequenceFile.Reader reader = new SequenceFile.Reader(fs,
        new Path("output/" + Cluster.CLUSTERED_POINTS_DIR
                 + "/part-m-00000"), conf);
   
    IntWritable key = new IntWritable();
    WeightedVectorWritable value = new WeightedVectorWritable();
    while (reader.next(key, value)) {
      System.out.println(value.toString() + " belongs to cluster "
                         + key.toString());
    }
    reader.close();
  }
View Full Code Here

    return latestRead;
  }


  IntWritable createWritable(Object previous, int v) throws IOException {
    IntWritable result = null;
    if (previous == null) {
      result = new IntWritable();
    } else {
      result = (IntWritable) previous;
    }
    result.set(v);
    return result;
  }
View Full Code Here

  }


  @Override
  public Object next(Object previous) throws IOException {
    IntWritable result = null;
    if (valuePresent) {
      result = createWritable(previous, readInt());
    }
    return result;
  }
View Full Code Here

    return o == null ? null : new OrcLazyInt((OrcLazyInt) o);
  }

  @Override
  public Object getPrimitiveJavaObject(Object o) {
    IntWritable writable = (IntWritable) getPrimitiveWritableObject(o);
    return writable == null ? null : Integer.valueOf(writable.get());
  }
View Full Code Here

  }

  public OrcLazyInt(OrcLazyInt copy) {
    super(copy);
    if (copy.previous != null) {
      previous = new IntWritable(((IntWritable)copy.previous).get());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.IntWritable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.