Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.SortedMapWritable


  }

  public SortedMapWritable readSortedMap(SortedMapWritable mw)
    throws IOException {
    if (mw == null) {
      mw = new SortedMapWritable();
    }
    int length = in.readMapHeader();
    for (int i = 0; i < length; i++) {
      WritableComparable key = (WritableComparable) read();
      Writable value = read();
View Full Code Here


        // get the hour this comment was posted in
        Date creationDate = frmt.parse(strDate);
        outHour.set(creationDate.getHours());

        commentLength.set(text.length());
        SortedMapWritable outCommentLength = new SortedMapWritable();
        outCommentLength.put(commentLength, ONE);

        // write out the user ID with min max dates and count
        context.write(outHour, outCommentLength);

      } catch (ParseException e) {
View Full Code Here

    @SuppressWarnings("rawtypes")
    protected void reduce(IntWritable key,
        Iterable<SortedMapWritable> values, Context context)
        throws IOException, InterruptedException {

      SortedMapWritable outValue = new SortedMapWritable();

      for (SortedMapWritable v : values) {
        for (Entry<WritableComparable, Writable> entry : v.entrySet()) {
          LongWritable count = (LongWritable) outValue.get(entry
              .getKey());

          if (count != null) {
            count.set(count.get()
                + ((LongWritable) entry.getValue()).get());
          } else {
            outValue.put(entry.getKey(), new LongWritable(
                ((LongWritable) entry.getValue()).get()));
          }
        }
      }
View Full Code Here

  }

  public SortedMapWritable readSortedMap(SortedMapWritable mw)
      throws IOException {
    if (mw == null) {
      mw = new SortedMapWritable();
    }
    int length = in.readMapHeader();
    for (int i = 0; i < length; i++) {
      WritableComparable key = (WritableComparable) read();
      Writable value = read();
View Full Code Here

  }

  public SortedMapWritable readSortedMap(SortedMapWritable mw)
    throws IOException {
    if (mw == null) {
      mw = new SortedMapWritable();
    }
    int length = in.readMapHeader();
    for (int i = 0; i < length; i++) {
      WritableComparable key = (WritableComparable) read();
      Writable value = read();
View Full Code Here

  }

  public SortedMapWritable readSortedMap(SortedMapWritable mw)
      throws IOException {
    if (mw == null) {
      mw = new SortedMapWritable();
    }
    int length = in.readMapHeader();
    for (int i = 0; i < length; i++) {
      WritableComparable key = (WritableComparable) read();
      Writable value = read();
View Full Code Here

TOP

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

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.