Package org.apache.crunch.io.text

Examples of org.apache.crunch.io.text.TextFileTarget


   *
   * @param path The {@code Path} to write the data to
   * @return A new {@code Target} instance
   */
  public static Target textFile(Path path) {
    return new TextFileTarget(path);
  }
View Full Code Here


   *
   * @param path The {@code Path} to write the data to
   * @return A new {@code Target} instance
   */
  public static Target textFile(Path path) {
    return new TextFileTarget(path);
  }
View Full Code Here

    writeFile(expected, infilename);

    Pipeline memPipeline = MemPipeline.getInstance();
    PCollection<String> memPColl = memPipeline.readTextFile(infilename);
    Target memTarget = new TextFileTarget(memOutFilename);
    memPipeline.write(memPColl, memTarget, WriteMode.OVERWRITE);
    memPipeline.run();
    File outDir = new File(memOutFilename);
    File actualMemOut = null;
    for (File f : outDir.listFiles()) {
      String name = f.getName();
      if (name.contains("out") && name.endsWith(".txt")) {
        actualMemOut = f;
        break;
      }
    }
    String actualMemText = Files.readFirstLine(actualMemOut, Charsets.UTF_8);

    Pipeline mrPipeline = new MRPipeline(getClass());
    PCollection<String> mrPColl = mrPipeline.readTextFile(infilename);
    Target mrTarget = new TextFileTarget(mrOutFilename);
    mrPipeline.write(mrPColl, mrTarget, WriteMode.OVERWRITE);
    mrPipeline.run();
    String actualMrText = Files.readFirstLine(new File(mrOutFilename + "/part-m-00000"), Charsets.UTF_8);

    Assert.assertEquals("MR file mismatch", expected, actualMrText);
View Full Code Here

  public static Target textFile(String pathName) {
    return textFile(new Path(pathName));
  }

  public static Target textFile(Path path) {
    return new TextFileTarget(path);
  }
View Full Code Here

   *
   * @param path The {@code Path} to write the data to
   * @return A new {@code Target} instance
   */
  public static Target textFile(Path path) {
    return new TextFileTarget(path);
  }
View Full Code Here

  public static Target textFile(String pathName) {
    return textFile(new Path(pathName));
  }

  public static Target textFile(Path path) {
    return new TextFileTarget(path);
  }
View Full Code Here

TOP

Related Classes of org.apache.crunch.io.text.TextFileTarget

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.