gaoyunhaii opened a new pull request #12918:
URL: https://github.com/apache/flink/pull/12918
## What is the purpose of the change
Currently when we want to create a file under the current directory with
relative path (e.g., `new Path("file")`), the `LocalFileSystem` fails when
trying to create the parent directory. This is due to that the parent path is
stored as an empty string and it is transformed to `new File("")` and `new
File("").isDirectory()` returns `false`, which indicates the caller that we
fail to create the parent directory.
To address this issue, we made the empty path transformed to `new
File(".")`, with which `isDirectory()` returns the expected `true`.
## Brief change log
*(for example:)*
- ab340bf17583063fa25158c00cd3214c404ca0dd changes the method
`pathToFile(Path path)` to process the empty path specially and transform it to
`new File(".")`.
## Verifying this change
This change added tests and can be verified as follows:
- Added UT to verify we could successfully create the file under current
directory with relative path. Since Java could not change the current
directory, we will have to try creating file under the current directory
instead of an TemporaryFolder (A another option might be start a new Process to
use the TemporaryFolder but it seems to be too heavy). We tried best to remove
the target file after the test.
## 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)`: **no**
- The serializers: **no**
- The runtime per-record code paths (performance sensitive): **no**
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: **no**
- The S3 file system connector: **no**
## Documentation
- Does this pull request introduce a new feature? **no**
- If yes, how is the feature documented? **not applicable**
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]