GitHub user fhueske opened a pull request:
https://github.com/apache/flink/pull/5415
Multipath merged
## What is the purpose of the change
* Add support to `FileInputFormat` to read from multiple paths. At the
moment only a single path is supported that can be recursively read if the path
is a directory.
* Maintain compatibility with existing input formats that extend
`FileInputFormat`
This PR is an extension / rework of PR #1990.
## Brief change log
`FileInputFormat` is declared as `@Public` interface.
* deprecate the `protected` variable `FileInputFormat.filePath` of type
`Path`. We need to store more than one path to support multiple paths.
* deprecate the method `FileInputFormat.getFilePath()`. We need to return a
list of paths.
* add a private member variable to `FileInputFormat` to store multiple
paths.
* add methods to set and get multiple paths.
* add a `deprecated` method `public boolean
FileInputFormat.supportsMultiPaths()` with default implementation `return
false;` that input formats can override if they support multiple paths. If the
method returns `true`, the deprecated `filePath` variable is not used anymore
and will always be `null`.
* changed all public sub classes of `FileInputFormat` to not directly
access the deprecated `filePath` variable but use the more generic
`getFilePaths()` method.
* We cannot override `supportsMultiPaths` in `DelimitedInputFormat` and
`BinaryInputFormat` because they are part of the public API and not final.
## Verifying this change
* added a couple of tests to validate that splits and statistics are
correctly generated.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): **no**
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: **YES**
- The serializers: **no**
- The runtime per-record code paths (performance sensitive): **no**
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Yarn/Mesos, ZooKeeper: **no**
- The S3 file system connector: **no**
## Documentation
- Does this pull request introduce a new feature? **yes**
- If yes, how is the feature documented? Only in JavaDocs so far.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/fhueske/flink multipath-merged
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/5415.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #5415
----
commit 13e84ff078d6112648dace7559139dea85f46c5d
Author: Phetsarath, Sourigna <gna.phetsarath@...>
Date: 2016-05-13T16:24:46Z
[FLINK-3655] Multiple File Paths for FileInputFormat.
commit d46b32726e3043debc94d097f2dc296841689d36
Author: Fabian Hueske <fhueske@...>
Date: 2018-02-05T13:40:50Z
[FLINK-3655] Multiple File Paths for FileInputFormat.
- Reverted API-breaking changes.
----
---