Package org.apache.flink.core.fs

Examples of org.apache.flink.core.fs.Path


  }
 
  // --------------------------------------------------------------------------------------------
 
  private static final DataSourceNode getSourceNode() {
    return new DataSourceNode(new GenericDataSourceBase<String, TextInputFormat>(new TextInputFormat(new Path("/")), new OperatorInformation<String>(BasicTypeInfo.STRING_TYPE_INFO)));
  }
View Full Code Here


    this.path = filePath;
    this.executionContext = executionContext;
  }
 
  public CsvReader(String filePath, ExecutionEnvironment executionContext) {
    this(new Path(Validate.notNull(filePath, "The file path may not be null.")), executionContext);
  }
View Full Code Here

//        "map"));
//  }
 
  private static final DataSourceNode getSourceNode() {
    return new DataSourceNode(new GenericDataSourceBase<String, TextInputFormat>(
        new TextInputFormat(new Path("/ignored")),
        new OperatorInformation<String>(BasicTypeInfo.STRING_TYPE_INFO),
        "source"));
  }
View Full Code Here

   
    DataOutputStream dos = new DataOutputStream(new FileOutputStream(tempFile));
    dos.writeBytes(content);
    dos.close();
     
    return new FileInputSplit(0, new Path(this.tempFile.toURI().toString()), 0, this.tempFile.length(), new String[] {"localhost"});
  }
View Full Code Here

      dos.writeInt(i);
    }
   
    dos.close();
     
    return new FileInputSplit(0, new Path(this.tempFile.toURI().toString()), 0, this.tempFile.length(), new String[] {"localhost"});
  }
View Full Code Here

  // --------------------------------------------------------------------------------------------
 
  @Before
  public void setup() throws IOException {
    this.tempFile = File.createTempFile("test_output", "tmp");
    this.format.setOutputFilePath(new Path(tempFile.toURI()));
    this.format.setWriteMode(WriteMode.OVERWRITE);
  }
View Full Code Here

      + CommonTestUtils.getRandomFilename());

    final File testfile2 = new File(tempdir.getAbsolutePath() + File.separator
      + CommonTestUtils.getRandomFilename());

    final Path pathtotestfile1 = new Path(testfile1.toURI().getPath());
    final Path pathtotestfile2 = new Path(testfile2.toURI().getPath());

    try {
      final LocalFileSystem lfs = new LocalFileSystem();

      final Path pathtotmpdir = new Path(tempdir.toURI().getPath());

      /*
       * check that lfs can see/create/delete/read directories
       */

 
View Full Code Here

        throw new IllegalArgumentException("The output path has been specified neither via constructor/setters" +
            ", nor via the Configuration.");
      }
     
      try {
        this.outputFilePath = new Path(filePath);
      }
      catch (RuntimeException rex) {
        throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage());
      }
    }
View Full Code Here

    if (LOG.isDebugEnabled()) {
      LOG.debug("Opening stream for output (" + (taskNumber+1) + "/" + numTasks + "). WriteMode=" + writeMode +
          ", OutputDirectoryMode=" + outputDirectoryMode);
    }
   
    Path p = this.outputFilePath;
    if (p == null) {
      throw new IOException("The file path is null.");
    }
   
    final FileSystem fs = p.getFileSystem();

    // if this is a local file system, we need to initialize the local output directory here
    if (!fs.isDistributedFS()) {
     
      if (numTasks == 1 && outputDirectoryMode == OutputDirectoryMode.PARONLY) {
        // output should go to a single file
       
        // prepare local output path. checks for write mode and removes existing files in case of OVERWRITE mode
        if(!fs.initOutPathLocalFS(p, writeMode, false)) {
          // output preparation failed! Cancel task.
          throw new IOException("Output path '" + p.toString() + "' could not be initialized. Canceling task...");
        }
      }
      else {
        // numTasks > 1 || outDirMode == OutputDirectoryMode.ALWAYS
       
        if(!fs.initOutPathLocalFS(p, writeMode, true)) {
          // output preparation failed! Cancel task.
          throw new IOException("Output directory '" + p.toString() + "' could not be created. Canceling task...");
        }
      }
    }
     
     
    // Suffix the path with the parallel instance index, if needed
    this.actualFilePath = (numTasks > 1 || outputDirectoryMode == OutputDirectoryMode.ALWAYS) ? p.suffix("/" + (taskNumber+1)) : p;

    // create output file
    this.stream = fs.create(this.actualFilePath, writeMode == WriteMode.OVERWRITE);
   
    // at this point, the file creation must have succeeded, or an exception has been thrown
View Full Code Here

   *
   * @param parallelism The task parallelism.
   */
  @Override
  public void initializeGlobal(int parallelism) throws IOException {
    final Path path = getOutputFilePath();
    final FileSystem fs = path.getFileSystem();
   
    // only distributed file systems can be initialized at start-up time.
    if (fs.isDistributedFS()) {
     
      final WriteMode writeMode = getWriteMode();
View Full Code Here

TOP

Related Classes of org.apache.flink.core.fs.Path

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.