Skip to content

Conversation

@andrey-tpt
Copy link

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:

  • Filesystem cache is enabled by default for all filesystems which are derived from org.apache.hadoop.fs.FileSystem
  • Configuration is not considered when instance of FileSystem is retrieved from the cache - it is not used to identify cache's key.

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

@zsxwing
Copy link
Member

zsxwing commented Jul 19, 2017

ok to test

@SparkQA
Copy link

SparkQA commented Jul 19, 2017

Test build #79768 has finished for PR 18623 at commit 317bd1b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

val fs = hdfsPath.getFileSystem(hadoopConf)
val qualified = hdfsPath.makeQualified(fs.getUri, fs.getWorkingDirectory)
SparkHadoopUtil.get.globPathIfNecessary(qualified)
SparkHadoopUtil.get.globPathIfNecessary(qualified, hadoopConf)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you pass FileSystem into globPathIfNecessary?

@asfgit asfgit closed this in 6cbd18c Aug 5, 2017
asfgit pushed a commit that referenced this pull request Aug 7, 2017
…sabled FS cache

This PR replaces #18623 to do some clean up.

Closes #18623

Jenkins

Author: Shixiong Zhu <[email protected]>
Author: Andrey Taptunov <[email protected]>

Closes #18848 from zsxwing/review-pr18623.
@andrey-tpt andrey-tpt deleted the globpath2 branch April 7, 2018 19:41
MatthewRBruce pushed a commit to Shopify/spark that referenced this pull request Jul 31, 2018
…sabled FS cache

This PR replaces apache#18623 to do some clean up.

Closes apache#18623

Jenkins

Author: Shixiong Zhu <[email protected]>
Author: Andrey Taptunov <[email protected]>

Closes apache#18848 from zsxwing/review-pr18623.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants