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 2022/06/21 11:48:48 UTC

[GitHub] [spark] Yikf opened a new pull request, #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Yikf opened a new pull request, #36941:
URL: https://github.com/apache/spark/pull/36941

   <!--
   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.
   -->
   The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1, to support something such as compressed formats
   
   ### 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.
   -->
   example:
   
   `spark.range(0, 100).writeTo("t1").option("compression", "zstd").using("parquet").create`
   
   **before**
   
   gen: part-00000-644a65ed-0e7a-43d5-8d30-b610a0fb19dc-c000.**snappy**.parquet ...
   
   **after**
   
   gen: part-00000-6eb9d1ae-8fdb-4428-aea3-bd6553954cdd-c000.**zstd**.parquet ...
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   new 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] cloud-fan closed pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1
URL: https://github.com/apache/spark/pull/36941


-- 
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 #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

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

   thanks, merging to master/3.3/3.2!


-- 
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 diff in pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36941:
URL: https://github.com/apache/spark/pull/36941#discussion_r903288724


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -531,6 +534,27 @@ class DataFrameWriterV2Suite extends QueryTest with SharedSparkSession with Befo
     assert(table.properties === (Map("provider" -> "foo") ++ defaultOwnership).asJava)
   }
 
+  test("SPARK-39543 writeOption should be passed to storage properties when fallback to v1") {
+    val provider = classOf[InMemoryV1Provider].getName
+    val oldConf = spark.sessionState.conf.getConf(SQLConf.USE_V1_SOURCE_LIST)
+      try {

Review Comment:
   nit: we can use `withSQLConf`



-- 
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 #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

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

   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] Yikf commented on a diff in pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
Yikf commented on code in PR #36941:
URL: https://github.com/apache/spark/pull/36941#discussion_r904480670


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -531,6 +534,23 @@ class DataFrameWriterV2Suite extends QueryTest with SharedSparkSession with Befo
     assert(table.properties === (Map("provider" -> "foo") ++ defaultOwnership).asJava)
   }
 
+  test("SPARK-39543 writeOption should be passed to storage properties when fallback to v1") {
+    val provider = classOf[InMemoryV1Provider].getName
+
+    withSQLConf((SQLConf.USE_V1_SOURCE_LIST.key, provider)) {

Review Comment:
   Yea, Other tests trigger v1 fallback without set `USE_V1_SOURCE_LIST `, AFAIK, 
   - Other tests aim to test the read/write process, and the `InMemoryV1Provider` is actually a v2 format, and we trigger v1 fallback at the `newScanBuilder` & `newWriteBuilder` layer.
   - This test in PR needs to be fallback to V1 when the table is created, so we need to set `USE_V1_SOURCE_LIST`(see: [isV2Provider](https://github.com/apache/spark/blob/3d68ad8003a16229bd79f86cb31f618167814a7f/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala#L604))



-- 
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 diff in pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36941:
URL: https://github.com/apache/spark/pull/36941#discussion_r903861542


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -531,6 +534,23 @@ class DataFrameWriterV2Suite extends QueryTest with SharedSparkSession with Befo
     assert(table.properties === (Map("provider" -> "foo") ++ defaultOwnership).asJava)
   }
 
+  test("SPARK-39543 writeOption should be passed to storage properties when fallback to v1") {
+    val provider = classOf[InMemoryV1Provider].getName
+
+    withSQLConf((SQLConf.USE_V1_SOURCE_LIST.key, provider)) {

Review Comment:
   looking at other tests that use `InMemoryV1Provider`, it seems we don't need to set `USE_V1_SOURCE_LIST` to trigger v1 fallback?



-- 
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] Yikf commented on pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
Yikf commented on PR #36941:
URL: https://github.com/apache/spark/pull/36941#issuecomment-1161645947

   Could you please take a look when you have a time, thanks @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.

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] Yikf commented on a diff in pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
Yikf commented on code in PR #36941:
URL: https://github.com/apache/spark/pull/36941#discussion_r903262921


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -531,6 +532,15 @@ class DataFrameWriterV2Suite extends QueryTest with SharedSparkSession with Befo
     assert(table.properties === (Map("provider" -> "foo") ++ defaultOwnership).asJava)
   }
 
+  test("SPARK-39543 writeOption should be passed to storage properties when fallback to v1") {
+    spark.range(10).writeTo("table_name").option("compression", "zstd").using("parquet").create()

Review Comment:
   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] Yikf commented on a diff in pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
Yikf commented on code in PR #36941:
URL: https://github.com/apache/spark/pull/36941#discussion_r903677309


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -531,6 +534,27 @@ class DataFrameWriterV2Suite extends QueryTest with SharedSparkSession with Befo
     assert(table.properties === (Map("provider" -> "foo") ++ defaultOwnership).asJava)
   }
 
+  test("SPARK-39543 writeOption should be passed to storage properties when fallback to v1") {
+    val provider = classOf[InMemoryV1Provider].getName
+    val oldConf = spark.sessionState.conf.getConf(SQLConf.USE_V1_SOURCE_LIST)
+      try {

Review Comment:
   Updated



-- 
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 diff in pull request #36941: [SPARK-39543] The option of DataFrameWriterV2 should be passed to storage properties if fallback to v1

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36941:
URL: https://github.com/apache/spark/pull/36941#discussion_r902729080


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -531,6 +532,15 @@ class DataFrameWriterV2Suite extends QueryTest with SharedSparkSession with Befo
     assert(table.properties === (Map("provider" -> "foo") ++ defaultOwnership).asJava)
   }
 
+  test("SPARK-39543 writeOption should be passed to storage properties when fallback to v1") {
+    spark.range(10).writeTo("table_name").option("compression", "zstd").using("parquet").create()

Review Comment:
   can we test with `InMemoryV1Provider`? We may migrate the file source to v2 completely in the future and then this test won't test the v1 fallback anymore.



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