You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:14:50 UTC

[GitHub] [spark] gengliangwang opened a new pull request #28760: [PARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

gengliangwang opened a new pull request #28760:
URL: https://github.com/apache/spark/pull/28760


   
   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   Data source options should be propagated into the Hadoop configuration of method `checkAndGlobPathIfNecessary`
   
   From `org.apache.hadoop.fs.FileSystem.java`:
   ```
     public static FileSystem get(URI uri, Configuration conf) throws IOException {
       String scheme = uri.getScheme();
       String authority = uri.getAuthority();
   
       if (scheme == null && authority == null) {     // use default FS
         return get(conf);
       }
   
       if (scheme != null && authority == null) {     // no authority
         URI defaultUri = getDefaultUri(conf);
         if (scheme.equals(defaultUri.getScheme())    // if scheme matches default
             && defaultUri.getAuthority() != null) {  // & default has authority
           return get(defaultUri, conf);              // return default
         }
       }
       
       String disableCacheName = String.format("fs.%s.impl.disable.cache", scheme);
       if (conf.getBoolean(disableCacheName, false)) {
         return createFileSystem(uri, conf);
       }
   
       return CACHE.get(uri, conf);
     }
   ```
   With this, we can specify authority and URI schema related configurations for scanning file systems.
   
   This problem only exists in data source V1. In V2, we already use `sparkSession.sessionState.newHadoopConfWithOptions(options)` in `FileTable`.
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   Allow users to specify authority and URI schema related Hadoop configurations for file source reading.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   Yes, the specified Hadoop configuration in data source option will be effective when Spark globbing all the paths.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   Unit test


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #28760: [SPARK-31935][SQL] Hadoop file system config should be effective in data source options

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-640937812






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #28760: [SPARK-31935][SQL] Hadoop file system config should be effective in data source options

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-642320379


   I'll make a follow-up PR.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] gengliangwang commented on pull request #28760: [PARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

Posted by GitBox <gi...@apache.org>.
gengliangwang commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-640937897






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28760: [PARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-640938193






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zsxwing commented on a change in pull request #28760: [SPARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

Posted by GitBox <gi...@apache.org>.
zsxwing commented on a change in pull request #28760:
URL: https://github.com/apache/spark/pull/28760#discussion_r437057671



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala
##########
@@ -570,7 +570,7 @@ case class DataSource(
       checkEmptyGlobPath: Boolean,
       checkFilesExist: Boolean): Seq[Path] = {
     val allPaths = caseInsensitiveOptions.get("path") ++ paths
-    val hadoopConf = sparkSession.sessionState.newHadoopConf()
+    val hadoopConf = sparkSession.sessionState.newHadoopConfWithOptions(options)

Review comment:
       There are multiple `newHadoopConf`s in this file. Should we also fix them?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] gengliangwang closed pull request #28760: [SPARK-31935][SQL] Hadoop file system config should be effective in data source options

Posted by GitBox <gi...@apache.org>.
gengliangwang closed pull request #28760:
URL: https://github.com/apache/spark/pull/28760


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28760: [PARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-640937812






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] gengliangwang commented on a change in pull request #28760: [SPARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

Posted by GitBox <gi...@apache.org>.
gengliangwang commented on a change in pull request #28760:
URL: https://github.com/apache/spark/pull/28760#discussion_r437060140



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala
##########
@@ -570,7 +570,7 @@ case class DataSource(
       checkEmptyGlobPath: Boolean,
       checkFilesExist: Boolean): Seq[Path] = {
     val allPaths = caseInsensitiveOptions.get("path") ++ paths
-    val hadoopConf = sparkSession.sessionState.newHadoopConf()
+    val hadoopConf = sparkSession.sessionState.newHadoopConfWithOptions(options)

Review comment:
       Yes, we should. I am adding more test cases.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #28760: [SPARK-31935][SQL] Hadoop file system config should be effective in data source options

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-642317164


   Hi, All.
   The new test case seems flaky. This fails consistently in `Hadoop 3.2 / Hive 2.3`.
   - https://amplab.cs.berkeley.edu/jenkins/view/Spark%20QA%20Test%20(Dashboard)/job/spark-master-test-sbt-hadoop-3.2-hive-2.3/789/testReport/org.apache.spark.sql/FileBasedDataSourceSuite/SPARK_31935__Hadoop_file_system_config_should_be_effective_in_data_source_options/history/
   
   ![Screen Shot 2020-06-10 at 4 22 12 PM](https://user-images.githubusercontent.com/9700541/84328331-8c616c00-ab36-11ea-8160-a559e8bab419.png)
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] liancheng commented on pull request #28760: [SPARK-31935][SQL] Hadoop file system config should be effective in data source options

Posted by GitBox <gi...@apache.org>.
liancheng commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-640995849


   LGTM, thanks!


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28760: [PARK-31935][SQL]Data source options should be propagated in method `checkAndGlobPathIfNecessary`

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-640938193






----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] gengliangwang commented on pull request #28760: [SPARK-31935][SQL] Hadoop file system config should be effective in data source options

Posted by GitBox <gi...@apache.org>.
gengliangwang commented on pull request #28760:
URL: https://github.com/apache/spark/pull/28760#issuecomment-641516116


   Merging to master.
   I will backport to branch-2.4 and branch-3.0 later


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org