protected FileInputFormat(Path filePath) { if (filePath != null) { setFilePath(filePath); } }
public void setFilePath(String filePath) { if (filePath == null) { throw new IllegalArgumentException("File path cannot be null."); } // TODO The job-submission web interface passes empty args (and thus empty // paths) to compute the preview graph. The following is a workaround for // this situation and we should fix this. // comment (Stephan Ewen) this should be no longer relevant with the current Java/Scala APIs. if (filePath.isEmpty()) { setFilePath(new Path()); return; } try { this.setFilePath(new Path(filePath)); } catch (RuntimeException rex) { throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage()); } }
/** * Configures the file input format by reading the file path from the configuration. * * @see org.apache.flink.api.common.io.InputFormat#configure(org.apache.flink.configuration.Configuration) */ @Override public void configure(Configuration parameters) { if (getFilePaths().length == 0) { // file path was not specified yet. Try to set it from the parameters. String filePath = parameters.getString(FILE_PARAMETER_KEY, null); if (filePath == null) { throw new IllegalArgumentException("File path was not specified in input format or configuration."); } else { setFilePath(filePath); } } if (!this.enumerateNestedFiles) { this.enumerateNestedFiles = parameters.getBoolean(ENUMERATE_NESTED_FILES_FLAG, false); } }
public <X> DataSource<X> readFile(FileInputFormat<X> inputFormat, String filePath) { if (inputFormat == null) { throw new IllegalArgumentException("InputFormat must not be null."); } if (filePath == null) { throw new IllegalArgumentException("The file path must not be null."); } inputFormat.setFilePath(new Path(filePath)); try { return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat)); } catch (Exception e) { throw new InvalidProgramException("The type returned by the input format could not be automatically determined. " + "Please specify the TypeInformation of the produced type explicitly by using the " + "'createInput(InputFormat, TypeInformation)' method instead."); } }
Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty."); inputFormat.setFilePath(filePath); return createFileInput(inputFormat, typeInformation, "Custom File Source", watchType, interval);
inputFormat.setFilePath(tempFile.toURI().toString());
@Test public void testCreateInputSplitSingleFile() throws IOException { String tempFile = TestFileUtils.createTempFile("Hello World"); FileInputFormat fif = new DummyFileInputFormat(); fif.setFilePath(tempFile); fif.configure(new Configuration()); FileInputSplit[] splits = fif.createInputSplits(2); Assert.assertEquals(2, splits.length); Assert.assertEquals(tempFile, splits[0].getPath().toString()); Assert.assertEquals(tempFile, splits[1].getPath().toString()); }
protected FileInputFormat(Path filePath) { if (filePath != null) { setFilePath(filePath); } }
protected FileInputFormat(Path filePath) { if (filePath != null) { setFilePath(filePath); } }
public void setFilePath(String filePath) { if (filePath == null) { throw new IllegalArgumentException("File path cannot be null."); } // TODO The job-submission web interface passes empty args (and thus empty // paths) to compute the preview graph. The following is a workaround for // this situation and we should fix this. // comment (Stephan Ewen) this should be no longer relevant with the current Java/Scala APIs. if (filePath.isEmpty()) { setFilePath(new Path()); return; } try { this.setFilePath(new Path(filePath)); } catch (RuntimeException rex) { throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage()); } }
public void setFilePath(String filePath) { if (filePath == null) { throw new IllegalArgumentException("File path cannot be null."); } // TODO The job-submission web interface passes empty args (and thus empty // paths) to compute the preview graph. The following is a workaround for // this situation and we should fix this. // comment (Stephan Ewen) this should be no longer relevant with the current Java/Scala APIs. if (filePath.isEmpty()) { setFilePath(new Path()); return; } try { this.setFilePath(new Path(filePath)); } catch (RuntimeException rex) { throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage()); } }
public <X> DataSource<X> readFile(FileInputFormat<X> inputFormat, String filePath) { if (inputFormat == null) { throw new IllegalArgumentException("InputFormat must not be null."); } if (filePath == null) { throw new IllegalArgumentException("The file path must not be null."); } inputFormat.setFilePath(new Path(filePath)); try { return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat)); } catch (Exception e) { throw new InvalidProgramException("The type returned by the input format could not be automatically determined. " + "Please specify the TypeInformation of the produced type explicitly by using the " + "'createInput(InputFormat, TypeInformation)' method instead."); } }
/** * Configures the file input format by reading the file path from the configuration. * * @see org.apache.flink.api.common.io.InputFormat#configure(org.apache.flink.configuration.Configuration) */ @Override public void configure(Configuration parameters) { if (getFilePaths().length == 0) { // file path was not specified yet. Try to set it from the parameters. String filePath = parameters.getString(FILE_PARAMETER_KEY, null); if (filePath == null) { throw new IllegalArgumentException("File path was not specified in input format or configuration."); } else { setFilePath(filePath); } } if (!this.enumerateNestedFiles) { this.enumerateNestedFiles = parameters.getBoolean(ENUMERATE_NESTED_FILES_FLAG, false); } }
public <X> DataSource<X> readFile(FileInputFormat<X> inputFormat, String filePath) { if (inputFormat == null) { throw new IllegalArgumentException("InputFormat must not be null."); } if (filePath == null) { throw new IllegalArgumentException("The file path must not be null."); } inputFormat.setFilePath(new Path(filePath)); try { return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat)); } catch (Exception e) { throw new InvalidProgramException("The type returned by the input format could not be automatically determined. " + "Please specify the TypeInformation of the produced type explicitly by using the " + "'createInput(InputFormat, TypeInformation)' method instead."); } }
public <X> DataSource<X> readFile(FileInputFormat<X> inputFormat, String filePath) { if (inputFormat == null) { throw new IllegalArgumentException("InputFormat must not be null."); } if (filePath == null) { throw new IllegalArgumentException("The file path must not be null."); } inputFormat.setFilePath(new Path(filePath)); try { return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat)); } catch (Exception e) { throw new InvalidProgramException("The type returned by the input format could not be automatically determined. " + "Please specify the TypeInformation of the produced type explicitly by using the " + "'createInput(InputFormat, TypeInformation)' method instead."); } }
/** * Configures the file input format by reading the file path from the configuration. * * @see org.apache.flink.api.common.io.InputFormat#configure(org.apache.flink.configuration.Configuration) */ @Override public void configure(Configuration parameters) { if (getFilePaths().length == 0) { // file path was not specified yet. Try to set it from the parameters. String filePath = parameters.getString(FILE_PARAMETER_KEY, null); if (filePath == null) { throw new IllegalArgumentException("File path was not specified in input format or configuration."); } else { setFilePath(filePath); } } if (!this.enumerateNestedFiles) { this.enumerateNestedFiles = parameters.getBoolean(ENUMERATE_NESTED_FILES_FLAG, false); } }
Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty."); inputFormat.setFilePath(filePath); return createFileInput(inputFormat, typeInformation, "Custom File Source", watchType, interval);
Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty."); inputFormat.setFilePath(filePath); return createFileInput(inputFormat, typeInformation, "Custom File Source", watchType, interval);
Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty."); inputFormat.setFilePath(filePath); return createFileInput(inputFormat, typeInformation, "Custom File Source", watchType, interval);
Preconditions.checkNotNull(filePath.isEmpty(), "The file path must not be empty."); inputFormat.setFilePath(filePath); return createFileInput(inputFormat, typeInformation, "Custom File Source", watchType, interval);