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 2021/09/06 23:50:51 UTC

[GitHub] [spark] planga82 opened a new pull request #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

planga82 opened a new pull request #33922:
URL: https://github.com/apache/spark/pull/33922


   <!--
   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'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### 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.
   -->
   Currently only DataSources V1 are supported in the CreateTempViewUsing command. This PR refactor DataframeReader to reuse the code for the creation of a DataFrame from a DataSource V2
   
   ### 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.
   -->
   Improve the support of DataSourve V2 in this command
   
   ### 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'.
   -->
   It does not change the current behavior, it only adds a new functionality
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   Unit testing


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


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


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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] planga82 commented on pull request #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   @cloud-fan what do you think? I'm not sure if I'm missing something. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


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


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   **[Test build #143061 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/143061/testReport)** for PR 33922 at commit [`098c485`](https://github.com/apache/spark/commit/098c485d2df95d445d87a698b0ec754d1fa6497c).
    * 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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Utils.scala
##########
@@ -83,4 +90,54 @@ private[sql] object DataSourceV2Utils extends Logging {
           options.asCaseSensitiveMap())
     }
   }
+
+  def loadV2Source(sparkSession: SparkSession, provider: TableProvider,
+      userSpecifiedSchema: Option[StructType], extraOptions: CaseInsensitiveMap[String],
+                   source: String, paths: String*): Option[DataFrame] = {
+    val catalogManager = sparkSession.sessionState.catalogManager
+    val sessionOptions = DataSourceV2Utils.extractSessionConfigs(
+      source = provider, conf = sparkSession.sessionState.conf)
+
+    val optionsWithPath = getOptionsWithPaths(extraOptions, paths: _*)
+
+    val finalOptions = sessionOptions.filterKeys(!optionsWithPath.contains(_)).toMap ++
+      optionsWithPath.originalMap
+    val dsOptions = new CaseInsensitiveStringMap(finalOptions.asJava)
+    val (table, catalog, ident) = provider match {
+      case _: SupportsCatalogOptions if userSpecifiedSchema.nonEmpty =>
+        throw new IllegalArgumentException(
+          s"$source does not support user specified schema. Please don't specify the schema.")
+      case hasCatalog: SupportsCatalogOptions =>
+        val ident = hasCatalog.extractIdentifier(dsOptions)
+        val catalog = CatalogV2Util.getTableProviderCatalog(
+          hasCatalog,
+          catalogManager,
+          dsOptions)
+        (catalog.loadTable(ident), Some(catalog), Some(ident))
+      case _ =>
+        // TODO: Non-catalog paths for DSV2 are currently not well defined.

Review comment:
       I know this comment was already existent before but wanted to make a note. This isn't a good example of a comment. There's no JIRA. and we don't know what's not well defined.




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Utils.scala
##########
@@ -83,4 +90,54 @@ private[sql] object DataSourceV2Utils extends Logging {
           options.asCaseSensitiveMap())
     }
   }
+
+  def loadV2Source(sparkSession: SparkSession, provider: TableProvider,
+      userSpecifiedSchema: Option[StructType], extraOptions: CaseInsensitiveMap[String],
+                   source: String, paths: String*): Option[DataFrame] = {

Review comment:
       ```suggestion
     def loadV2Source(
         sparkSession: SparkSession,
         provider: TableProvider,
         userSpecifiedSchema: Option[StructType],
         extraOptions: CaseInsensitiveMap[String],
         source: String,
         paths: String*): Option[DataFrame] = {
   ```




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ddl.scala
##########
@@ -87,15 +89,21 @@ case class CreateTempViewUsing(
       throw QueryCompilationErrors.cannotCreateTempViewUsingHiveDataSourceError()
     }
 
-    val dataSource = DataSource(
-      sparkSession,
-      userSpecifiedSchema = userSpecifiedSchema,
-      className = provider,
-      options = options)
-
     val catalog = sparkSession.sessionState.catalog
-    val analyzedPlan = Dataset.ofRows(
-      sparkSession, LogicalRelation(dataSource.resolveRelation())).logicalPlan
+    val analyzedPlan = DataSource.lookupDataSourceV2(provider, sparkSession.sessionState.conf)
+      .map { tblProvider =>

Review comment:
       ```suggestion
         .flatMap { tblProvider =>
   ```




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   **[Test build #143031 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/143031/testReport)** for PR 33922 at commit [`181c5d1`](https://github.com/apache/spark/commit/181c5d19d819debef1ebe50a078acbb4bfe512a8).


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   **[Test build #143031 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/143031/testReport)** for PR 33922 at commit [`181c5d1`](https://github.com/apache/spark/commit/181c5d19d819debef1ebe50a078acbb4bfe512a8).


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Can one of the admins verify this patch?


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Utils.scala
##########
@@ -83,4 +90,54 @@ private[sql] object DataSourceV2Utils extends Logging {
           options.asCaseSensitiveMap())
     }
   }
+
+  def loadV2Source(sparkSession: SparkSession, provider: TableProvider,
+      userSpecifiedSchema: Option[StructType], extraOptions: CaseInsensitiveMap[String],
+                   source: String, paths: String*): Option[DataFrame] = {
+    val catalogManager = sparkSession.sessionState.catalogManager
+    val sessionOptions = DataSourceV2Utils.extractSessionConfigs(
+      source = provider, conf = sparkSession.sessionState.conf)
+
+    val optionsWithPath = getOptionsWithPaths(extraOptions, paths: _*)
+
+    val finalOptions = sessionOptions.filterKeys(!optionsWithPath.contains(_)).toMap ++
+      optionsWithPath.originalMap
+    val dsOptions = new CaseInsensitiveStringMap(finalOptions.asJava)
+    val (table, catalog, ident) = provider match {
+      case _: SupportsCatalogOptions if userSpecifiedSchema.nonEmpty =>
+        throw new IllegalArgumentException(
+          s"$source does not support user specified schema. Please don't specify the schema.")
+      case hasCatalog: SupportsCatalogOptions =>
+        val ident = hasCatalog.extractIdentifier(dsOptions)
+        val catalog = CatalogV2Util.getTableProviderCatalog(
+          hasCatalog,
+          catalogManager,
+          dsOptions)
+        (catalog.loadTable(ident), Some(catalog), Some(ident))
+      case _ =>
+        // TODO: Non-catalog paths for DSV2 are currently not well defined.
+        val tbl = DataSourceV2Utils.getTableFromProvider(provider, dsOptions, userSpecifiedSchema)
+        (tbl, None, None)
+    }
+    import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Implicits._
+    table match {
+      case _: SupportsRead if table.supports(BATCH_READ) =>
+        Option(Dataset.ofRows(
+          sparkSession,
+          DataSourceV2Relation.create(table, catalog, ident, dsOptions)))
+      case _ => None
+    }
+  }
+
+  private def getOptionsWithPaths(extraOptions: CaseInsensitiveMap[String],
+      paths: String*): CaseInsensitiveMap[String] = {

Review comment:
       ```suggestion
     private def getOptionsWithPaths(
         extraOptions: CaseInsensitiveMap[String],
         paths: String*): CaseInsensitiveMap[String] = {
   ```




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 pull request #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   ok to test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   **[Test build #143061 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/143061/testReport)** for PR 33922 at commit [`098c485`](https://github.com/apache/spark/commit/098c485d2df95d445d87a698b0ec754d1fa6497c).


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/47533/
   


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2Suite.scala
##########
@@ -435,6 +435,18 @@ class DataSourceV2Suite extends QueryTest with SharedSparkSession with AdaptiveS
       }
     }
   }
+
+  test("SPARK-35803: Support datasorce V2 in CREATE VIEW USING") {
+    Seq(classOf[SimpleDataSourceV2], classOf[JavaSimpleDataSourceV2]).foreach { cls =>
+      withClue(cls.getName) {
+        sql(s"CREATE or REPLACE GLOBAL TEMPORARY VIEW s1 USING ${cls.getName}")

Review comment:
       We should test with normal temp view unless there is something special with the global temp view




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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] planga82 commented on a change in pull request #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2Suite.scala
##########
@@ -435,6 +435,18 @@ class DataSourceV2Suite extends QueryTest with SharedSparkSession with AdaptiveS
       }
     }
   }
+
+  test("SPARK-35803: Support datasorce V2 in CREATE VIEW USING") {
+    Seq(classOf[SimpleDataSourceV2], classOf[JavaSimpleDataSourceV2]).foreach { cls =>
+      withClue(cls.getName) {
+        sql(s"CREATE or REPLACE GLOBAL TEMPORARY VIEW s1 USING ${cls.getName}")

Review comment:
       Yes, there is no reason for this test




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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] planga82 commented on a change in pull request #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Utils.scala
##########
@@ -83,4 +90,54 @@ private[sql] object DataSourceV2Utils extends Logging {
           options.asCaseSensitiveMap())
     }
   }
+
+  def loadV2Source(sparkSession: SparkSession, provider: TableProvider,
+      userSpecifiedSchema: Option[StructType], extraOptions: CaseInsensitiveMap[String],
+                   source: String, paths: String*): Option[DataFrame] = {
+    val catalogManager = sparkSession.sessionState.catalogManager
+    val sessionOptions = DataSourceV2Utils.extractSessionConfigs(
+      source = provider, conf = sparkSession.sessionState.conf)
+
+    val optionsWithPath = getOptionsWithPaths(extraOptions, paths: _*)
+
+    val finalOptions = sessionOptions.filterKeys(!optionsWithPath.contains(_)).toMap ++
+      optionsWithPath.originalMap
+    val dsOptions = new CaseInsensitiveStringMap(finalOptions.asJava)
+    val (table, catalog, ident) = provider match {
+      case _: SupportsCatalogOptions if userSpecifiedSchema.nonEmpty =>
+        throw new IllegalArgumentException(
+          s"$source does not support user specified schema. Please don't specify the schema.")
+      case hasCatalog: SupportsCatalogOptions =>
+        val ident = hasCatalog.extractIdentifier(dsOptions)
+        val catalog = CatalogV2Util.getTableProviderCatalog(
+          hasCatalog,
+          catalogManager,
+          dsOptions)
+        (catalog.loadTable(ident), Some(catalog), Some(ident))
+      case _ =>
+        // TODO: Non-catalog paths for DSV2 are currently not well defined.

Review comment:
       Yes, I think the same, when I read it I tried to understand what was missing but I didn't get it. Shall we delete it?




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/47564/
   


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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






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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


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


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/47533/
   


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   **[Test build #143061 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/143061/testReport)** for PR 33922 at commit [`098c485`](https://github.com/apache/spark/commit/098c485d2df95d445d87a698b0ec754d1fa6497c).


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/47564/
   


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   **[Test build #143031 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/143031/testReport)** for PR 33922 at commit [`181c5d1`](https://github.com/apache/spark/commit/181c5d19d819debef1ebe50a078acbb4bfe512a8).
    * 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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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






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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


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


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


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


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Can one of the admins verify this patch?


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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 #33922: [SPARK-35803][SQL] Support DataSource V2 CreateTempViewUsing

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


   Can one of the admins verify this patch?


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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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