Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.LongWritable


      int getCalls = 0;

      @Override
      public Object get(long currentRow, Object previous) throws IOException {
        if (getCalls == 0) {
          return new LongWritable(1);
        }

        throw new IOException("get should only be called once");
      }
View Full Code Here


  }

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

}

  /** {@inheritDoc} */
public LongWritable createKey()
{
  return new LongWritable()
}
View Full Code Here

public class InfiniDoopInputMapper extends MapReduceBase implements
Mapper<LongWritable, InfiniDoopRecord, LongWritable, Text> {

  public void map(LongWritable key, InfiniDoopRecord val,
      OutputCollector<LongWritable, Text> output, Reporter reporter) throws IOException {
    output.collect(new LongWritable(val.id), new Text(val.name));
  }
View Full Code Here

public class InfiniDoopInputMapper extends MapReduceBase implements
Mapper<LongWritable, InfiniDoopRecord, LongWritable, Text> {

  public void map(LongWritable key, InfiniDoopRecord val,
      OutputCollector<LongWritable, Text> output, Reporter reporter) throws IOException {
    output.collect(new LongWritable(val.id), new Text(val.name));
  }
View Full Code Here

  /** {@inheritDoc} */
  public boolean nextKeyValue() throws IOException {
    try {
      if (key == null) {
        key = new LongWritable();
      }
      if (value == null) {
        value = createValue();
      }
      if (null == this.results) {
View Full Code Here

  /** {@inheritDoc} */
  public boolean nextKeyValue() throws IOException {
    try {
      if (key == null) {
        key = new LongWritable();
      }
      if (value == null) {
        value = createValue();
      }
      if (null == this.results) {
View Full Code Here

      //we should be safe since this is set by our own code
      Path src = new Path(srcfilelist);
      FileSystem fs = src.getFileSystem(jconf);
      FileStatus fstatus = fs.getFileStatus(src);
      ArrayList<FileSplit> splits = new ArrayList<FileSplit>(numSplits);
      LongWritable key = new LongWritable();
      Text value = new Text();
      SequenceFile.Reader reader = null;
      // the remaining bytes in the file split
      long remaining = fstatus.getLen();
      // the count of sizes calculated till now
      long currentCount = 0L;
      // the endposition of the split
      long lastPos = 0L;
      // the start position of the split
      long startPos = 0L;
      long targetSize = totalSize/numSplits;
      // create splits of size target size so that all the maps
      // have equals sized data to read and write to.
      try {
        reader = new SequenceFile.Reader(fs, src, jconf);
        while(reader.next(key, value)) {
          if (currentCount + key.get() > targetSize && currentCount != 0){
            long size = lastPos - startPos;
            splits.add(new FileSplit(src, startPos, size, (String[]) null));
            remaining = remaining - size;
            startPos = lastPos;
            currentCount = 0L;
          }
          currentCount += key.get();
          lastPos = reader.getPosition();
        }
        // the remaining not equal to the target size.
        if (remaining != 0) {
          splits.add(new FileSplit(src, startPos, remaining, (String[])null));
View Full Code Here

      }
      return new RecordReader<LongWritable, LongWritable>() {
        long start = -1;
        long slept = 0L;
        long sleep = 0L;
        final LongWritable key = new LongWritable();
        final LongWritable val = new LongWritable();

        @Override
        public boolean nextKeyValue() throws IOException {
          if (start == -1) {
            start = System.currentTimeMillis();
          }
          slept += sleep;
          sleep = Math.min(duration - slept, RINTERVAL);
          key.set(slept + sleep + start);
          val.set(duration - slept);
          return slept < duration;
        }

        @Override
        public float getProgress() throws IOException {
View Full Code Here

        out.close();
      }
      // rename to final location
      fs.rename(tempFile, new Path(DATA_DIR, name));

      collector.collect(new UTF8("bytes"), new LongWritable(written));

      reporter.setStatus("wrote " + name);
    }
View Full Code Here

TOP

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

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.