Package org.apache.crunch

Examples of org.apache.crunch.Pair.first()


            Path outputPath = new Path(path, "out" + outputIndex + ".txt");
            FSDataOutputStream os = fs.create(outputPath);
            if (collection instanceof PTable) {
              for (Object o : collection.materialize()) {
                Pair p = (Pair) o;
                os.writeBytes(p.first().toString());
                os.writeBytes("\t");
                os.writeBytes(p.second().toString());
                os.writeBytes("\r\n");
              }
            } else {
View Full Code Here


    TupleN newTuple = toi.create("Alice", 28, 165.2f);
    assertEquals(tuple, newTuple);
    TupleObjectInspector<Pair> poi = new TupleObjectInspector<Pair>(TupleFactory.PAIR,
        Writables.strings(), Writables.ints());
    Pair pair = poi.create("word", 29);
    assertEquals("word", pair.first());
    assertEquals(29, pair.second());
  }
 
  @Test
  public void testByteBufferObjectInspector() {
View Full Code Here

          } else {
            LOG.warn("Defaulting to write to a text file from MemPipeline");
            if (collection instanceof PTable) {
              for (Object o : collection.materialize()) {
                Pair p = (Pair) o;
                os.writeBytes(p.first().toString());
                os.writeBytes("\t");
                os.writeBytes(p.second().toString());
                os.writeBytes("\r\n");
              }
            } else {
View Full Code Here

            byte[] newLine = "\r\n".getBytes(Charsets.UTF_8);
            if (collection instanceof PTable) {
              byte[] tab = "\t".getBytes(Charsets.UTF_8);
              for (Object o : collection.materialize()) {
                Pair p = (Pair) o;
                os.write(p.first().toString().getBytes(Charsets.UTF_8));
                os.write(tab);
                os.write(p.second().toString().getBytes(Charsets.UTF_8));
                os.write(newLine);
              }
            } else {
View Full Code Here

        FSDataOutputStream os = fs.create(new Path(path, "out" + outputIndex));
        outputIndex++;
        if (collection instanceof PTable) {
          for (Object o : collection.materialize()) {
            Pair p = (Pair) o;
            os.writeBytes(p.first().toString());
            os.writeBytes("\t");
            os.writeBytes(p.second().toString());
            os.writeBytes("\r\n");
          }
        } else {
View Full Code Here

            byte[] newLine = "\r\n".getBytes(Charsets.UTF_8);
            if (collection instanceof PTable) {
              byte[] tab = "\t".getBytes(Charsets.UTF_8);
              for (Object o : collection.materialize()) {
                Pair p = (Pair) o;
                os.write(p.first().toString().getBytes(Charsets.UTF_8));
                os.write(tab);
                os.write(p.second().toString().getBytes(Charsets.UTF_8));
                os.write(newLine);
              }
            } else {
View Full Code Here

          } else {
            LOG.warn("Defaulting to write to a text file from MemPipeline");
            if (collection instanceof PTable) {
              for (Object o : collection.materialize()) {
                Pair p = (Pair) o;
                os.writeBytes(p.first().toString());
                os.writeBytes("\t");
                os.writeBytes(p.second().toString());
                os.writeBytes("\r\n");
              }
            } else {
View Full Code Here

        FSDataOutputStream os = fs.create(new Path(path, "out" + outputIndex));
        outputIndex++;
        if (collection instanceof PTable) {
          for (Object o : collection.materialize()) {
            Pair p = (Pair) o;
            os.writeBytes(p.first().toString());
            os.writeBytes("\t");
            os.writeBytes(p.second().toString());
            os.writeBytes("\r\n");
          }
        } else {
View Full Code Here

        FileSystem fs = path.getFileSystem(conf);
        FSDataOutputStream os = fs.create(new Path(path, "out"));
        if (collection instanceof PTable) {
          for (Object o : collection.materialize()) {
            Pair p = (Pair) o;
            os.writeBytes(p.first().toString());
            os.writeBytes("\t");
            os.writeBytes(p.second().toString());
            os.writeBytes("\r\n");
          }
        } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.