[SPARK-21374][CORE] Fix reading globbed paths from S3 into DF with disabled FS cache #18623
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
SparkHadoopUtil.globPath method uses incorrect configuration to retrieve instance of org.apache.hadoop.fs.FileSystem.
Accidentally, this can work correctly for two reasons:
Therefore, incorrect configuration is omitted in SparkHadoopUtil.globPath and previously initialized instance of FileSystem is returned with correct configuration.
However, if filesystem caching is disabled (non-default behavior) incorrect configuration in SparkHadoopUtils.globPath is passed to org.apache.hadoop.fs.FileSystem.get() method what creates new instance of FileSystem with this incorrect configuration.
In this change two overloaded methods (globPath and globPathIfNecessary) are added to SparkHadoopUtil class which can receive up to date configuration from caller method. These two methods are used in DataSource class to read into DataFrame from globbed path.
How was this patch tested?
./dev/run-tests passed + example from SPARK-21374 was tested with patched jars.
@zsxwing @liancheng