Package org.apache.hadoop.typedbytes

Examples of org.apache.hadoop.typedbytes.TypedBytesWritable


      Path file = new Path(root, "test.seq");
      assertTrue(fs.exists(file));
      SequenceFile.Reader reader = new SequenceFile.Reader(fs, file, conf);
      int counter = 0;
      TypedBytesWritable key = new TypedBytesWritable();
      TypedBytesWritable value = new TypedBytesWritable();
      while (reader.next(key, value)) {
        assertEquals(Long.class, key.getValue().getClass());
        assertEquals(String.class, value.getValue().getClass());
        assertTrue("Invalid record.",
          Integer.parseInt(value.toString()) % 10 == 0);
        counter++;
      }
      assertEquals("Wrong number of records.", 100, counter);
    } finally {
      try {
View Full Code Here


 
  @Override
  public void initialize(PipeMapRed pipeMapRed) throws IOException {
    super.initialize(pipeMapRed);
    clientIn = pipeMapRed.getClientInput();
    key = new TypedBytesWritable();
    value = new TypedBytesWritable();
    in = new TypedBytesInput(clientIn);
  }
View Full Code Here

  }

  @Override
  public String getLastOutput() {
    if (bytes != null) {
      return new TypedBytesWritable(bytes).toString();
    } else {
      return null;
    }
  }
View Full Code Here

    }
    TypedBytesInput tbinput = new TypedBytesInput(new DataInputStream(System.in));
    SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, path,
      TypedBytesWritable.class, TypedBytesWritable.class);
    try {
      TypedBytesWritable key = new TypedBytesWritable();
      TypedBytesWritable value = new TypedBytesWritable();
      byte[] rawKey = tbinput.readRaw();
      while (rawKey != null) {
        byte[] rawValue = tbinput.readRaw();
        key.set(rawKey, 0, rawKey.length);
        value.set(rawValue, 0, rawValue.length);
        writer.append(key, value);
        rawKey = tbinput.readRaw();
      }
    } finally {
      writer.close();
View Full Code Here

  TypedBytesWritable value;

  public SequenceFileExportWriter(Configuration conf, Path path)
      throws Exception {
    FileSystem fs = FileSystem.get(conf);
    key = new TypedBytesWritable();
    value = new TypedBytesWritable();
    writer = SequenceFile.createWriter(fs, conf, path, TypedBytesWritable.class,
        TypedBytesWritable.class);
  }
View Full Code Here

  private TypedBytesWritable key;
  private TypedBytesWritable value;

  public MathematicaTask(TaskInputOutputContext<?, ?, TypedBytesWritable, TypedBytesWritable> context) {
    this.context = context;
    key = new TypedBytesWritable();
    value = new TypedBytesWritable();
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.typedbytes.TypedBytesWritable

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.