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/09/10 10:46:22 UTC

[GitHub] [spark] xuanyuanking opened a new pull request #29712: [SPARK-32844]Make `DataFrameReader.table` take the specified options for datasource v1

xuanyuanking opened a new pull request #29712:
URL: https://github.com/apache/spark/pull/29712


   <!--
   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.
   -->
   
   
   ### 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.
   -->
   
   
   ### 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'.
   -->
   
   
   ### 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.
   -->
   


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128565 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128565/testReport)** for PR 29712 at commit [`05aa245`](https://github.com/apache/spark/commit/05aa2451745acad3cf03b6f284b3e2387eb2ccac).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128579 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128579/testReport)** for PR 29712 at commit [`f3f8c8d`](https://github.com/apache/spark/commit/f3f8c8db3481d40622220c417afdb9d6eb9cfc50).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/33190/
   Test PASSed.


----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r487046193



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128564 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128564/testReport)** for PR 29712 at commit [`cc250b9`](https://github.com/apache/spark/commit/cc250b90ec284eddc64a7138e3b849bb5775f7a6).


----------------------------------------------------------------
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] xuanyuanking commented on pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   cc @cloud-fan 


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128564 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128564/testReport)** for PR 29712 at commit [`cc250b9`](https://github.com/apache/spark/commit/cc250b90ec284eddc64a7138e3b849bb5775f7a6).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128579 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128579/testReport)** for PR 29712 at commit [`f3f8c8d`](https://github.com/apache/spark/commit/f3f8c8db3481d40622220c417afdb9d6eb9cfc50).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128511 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128511/testReport)** for PR 29712 at commit [`33b8fca`](https://github.com/apache/spark/commit/33b8fcab9809af18caf90fda4d33f1a6d12e80da).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128518 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128518/testReport)** for PR 29712 at commit [`b4aa95e`](https://github.com/apache/spark/commit/b4aa95e3d3301916439f238cc3438d74fafbd2e4).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
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] HyukjinKwon commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       We can remove `private[sql]` since execution package is already private (SPARK-16964)




----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r487049743



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`




----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.




----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128511 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128511/testReport)** for PR 29712 at commit [`33b8fca`](https://github.com/apache/spark/commit/33b8fcab9809af18caf90fda4d33f1a6d12e80da).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.




----------------------------------------------------------------
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] cloud-fan closed pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #29712:
URL: https://github.com/apache/spark/pull/29712


   


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r486895542



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`




----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.




----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       Thanks, done in cc250b9.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +192,15 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(

Review comment:
       Ah yeah, thanks for reminding, done in cc250b9.

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Sure, done in cc250b9.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       Thanks, done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       Done in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.




----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r487047471



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r486895542



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128518 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128518/testReport)** for PR 29712 at commit [`b4aa95e`](https://github.com/apache/spark/commit/b4aa95e3d3301916439f238cc3438d74fafbd2e4).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       Rephased in f3f8c8d.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       Thanks, done in f3f8c8d.




----------------------------------------------------------------
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] cloud-fan commented on pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #29712:
URL: https://github.com/apache/spark/pull/29712#issuecomment-691931595


   thanks, merging to master!


----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r487048234



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r486390894



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -251,24 +255,25 @@ class FindDataSourceTable(sparkSession: SparkSession) extends Rule[LogicalPlan]
           partitionColumns = table.partitionColumnNames,
           bucketSpec = table.bucketSpec,
           className = table.provider.get,
-          options = table.storage.properties ++ pathOption,
+          options = extraOptions.asCaseSensitiveMap.asScala.toMap
+            ++ table.storage.properties ++ pathOption,

Review comment:
       nit: let's say table properties have `key=1`, and `extraOptions` have `KEY=1`. The check can pass, but the final options have both `key` and `KEY`.  We should avoid it and keeping `key` from table properties.




----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +191,18 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(
+      extraOptionsMap: Map[String, String], table: CatalogTable): Unit = {

Review comment:
       Copy that, done in b4aa95e.




----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r487047278



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`




----------------------------------------------------------------
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] HyukjinKwon commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
##########
@@ -1190,4 +1190,24 @@ class DataFrameReaderWriterSuite extends QueryTest with SharedSparkSession with
     verifyLoadFails(df.write.option("path", path).format("parquet").save(path))
     verifyLoadFails(df.write.option("path", path).format("parquet").save(""))
   }
+
+  test("DataFrameReader.table take the specified options for V1 relation") {

Review comment:
       Shall we add a JIRA prefix in the test title?




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128518 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128518/testReport)** for PR 29712 at commit [`b4aa95e`](https://github.com/apache/spark/commit/b4aa95e3d3301916439f238cc3438d74fafbd2e4).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/128511/
   Test FAILed.


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r486895722



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128565 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128565/testReport)** for PR 29712 at commit [`05aa245`](https://github.com/apache/spark/commit/05aa2451745acad3cf03b6f284b3e2387eb2ccac).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128579 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128579/testReport)** for PR 29712 at commit [`f3f8c8d`](https://github.com/apache/spark/commit/f3f8c8db3481d40622220c417afdb9d6eb9cfc50).


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r486895542



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +
+        "extra options will be merged. Otherwise, an exception will be thrown.")

Review comment:
       `will be merged with the table serde properties as the scan options`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       table serde properties.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {

Review comment:
       `extraOptionsMap` -> `extraOptions`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `create datasource` -> `resolve data source`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       `table.identifier.table`  -> `table.identifier`, so that we include database name as well.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       table serde property

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +

Review comment:
       `input options` -> `extra options`

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +
+              "rollback to the legacy behavior of ignoring the input options by setting the " +
+              s"config ${SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR.key} to `false`, or address the " +
+              s"conflicts of the same config.")
+        }
+      }
+      // To keep the original key from table properties, here we filter all case insensitive
+      // duplicate keys out from extra options.
+      val caseInsensitiveDuplicateKeys =

Review comment:
       nit: `lowerCasedDuplicatedKeys`




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   Merged build finished. Test PASSed.


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -2732,6 +2732,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_EXTRA_OPTIONS_BEHAVIOR =
+    buildConf("spark.sql.legacy.extraOptionsBehavior.enabled")
+      .internal()
+      .doc("When true, the extra options will be ignored for DataFrameReader.table(). If set it " +
+        "to false, which is the default, Spark will check if the extra options have the same " +
+        "key, but the value is different with the table properties. If the check passes, the " +

Review comment:
       Thanks, done in 05aa245.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r486250807



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +191,18 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  private[sql] def checkDuplicateOptions(
+      extraOptionsMap: Map[String, String], table: CatalogTable): Unit = {

Review comment:
       we should take care of case sensitivity:
   ```
   def checkConflictingOptions(table: CatalogTable, options: CaseInsensitiveStringMap): Unit = {
     table.storage.properties.foreach { case (k, v) =>
       if (options.get(k) == v) throw ...
     }
   }
   ```




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] cloud-fan commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #29712:
URL: https://github.com/apache/spark/pull/29712#discussion_r487047875



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +
+              s"property has the duplicated key $k with input options. To fix this, you can " +

Review comment:
       `input options` -> `extra options specified for this scan operation.`




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] xuanyuanking commented on a change in pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceUtils.scala
##########
@@ -190,4 +194,33 @@ object DataSourceUtils {
     case LegacyBehaviorPolicy.LEGACY => RebaseDateTime.rebaseGregorianToJulianMicros
     case LegacyBehaviorPolicy.CORRECTED => identity[Long]
   }
+
+  def generateDatasourceOptions(
+      extraOptionsMap: CaseInsensitiveStringMap, table: CatalogTable): Map[String, String] = {
+    val pathOption = table.storage.locationUri.map("path" -> CatalogUtils.URIToString(_))
+    val options = table.storage.properties ++ pathOption
+    if (!SQLConf.get.getConf(SQLConf.LEGACY_EXTRA_OPTIONS_BEHAVIOR)) {
+      // Check the same key with different values
+      table.storage.properties.foreach { case (k, v) =>
+        if (extraOptionsMap.containsKey(k) && extraOptionsMap.get(k) != v) {
+          throw new AnalysisException(
+            s"Fail to create datasource for the table ${table.identifier.table} since the table " +

Review comment:
       Copy, rephased in f3f8c8d.




----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128511 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128511/testReport)** for PR 29712 at commit [`33b8fca`](https://github.com/apache/spark/commit/33b8fcab9809af18caf90fda4d33f1a6d12e80da).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `case class UnresolvedCatalogRelation(`


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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






----------------------------------------------------------------
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] xuanyuanking commented on pull request #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   Thanks for the review.


----------------------------------------------------------------
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 #29712: [SPARK-32844][SQL] Make `DataFrameReader.table` take the specified options for datasource v1

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


   **[Test build #128564 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/128564/testReport)** for PR 29712 at commit [`cc250b9`](https://github.com/apache/spark/commit/cc250b90ec284eddc64a7138e3b849bb5775f7a6).


----------------------------------------------------------------
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