You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2023/05/05 08:06:33 UTC

[GitHub] [spark] pan3793 opened a new pull request, #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

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

   <!--
   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.
   -->
   - Change `SupportsCustomSchemaWrite` to extend `Table`
   - Replace `StructType` w/ `Column[]`
   
   ### 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.
   -->
   SPARK-42398 introduces `Column`, which should be used in the new DSv2 API.
   
   ### 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'.
   -->
   No, unreleased feature
   
   ### 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.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   UT is changed as well.


-- 
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] pan3793 commented on pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #41062:
URL: https://github.com/apache/spark/pull/41062#issuecomment-1535897335

   @dtenedor @gengliangwang 


-- 
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] pan3793 commented on pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #41062:
URL: https://github.com/apache/spark/pull/41062#issuecomment-1538085206

   kindly ping @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] dtenedor commented on a diff in pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "dtenedor (via GitHub)" <gi...@apache.org>.
dtenedor commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1196820360


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {
     /**
      * Represents a table with a custom schema to use for resolving DEFAULT column references when
      * inserting into the table. For example, this can be useful for excluding hidden pseudocolumns.
      *
      * @return the new schema to use for this process.
      */
-    StructType customSchemaForInserts();
+    Column[] customColumnsForInserts();

Review Comment:
   LGTM



-- 
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] pan3793 commented on a diff in pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1197682260


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -18,21 +18,22 @@
 package org.apache.spark.sql.connector.write;
 
 import org.apache.spark.annotation.Evolving;
-import org.apache.spark.sql.types.StructType;
+import org.apache.spark.sql.connector.catalog.Column;
+import org.apache.spark.sql.connector.catalog.Table;
 
 /**
  * Trait for tables that support custom schemas for write operations including INSERT INTO commands
  * whose target table columns have explicit or implicit default values.
  *
- * @since 3.4.1
+ * @since 3.5.0

Review Comment:
   Change to 3.5.0 since it is [reverted](https://github.com/apache/spark/commit/079594ae976b377459ad09d864106734ef65c32d) from branch-3.4



-- 
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] pan3793 commented on a diff in pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1186140005


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {

Review Comment:
   Don't have strong opinion, would like to listen more voice from the DSv2 experts @cloud-fan @aokolnychyi



-- 
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] dtenedor commented on a diff in pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "dtenedor (via GitHub)" <gi...@apache.org>.
dtenedor commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1196819921


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {

Review Comment:
   it seems fine for this to inherit from `Table` to me, up to the rest of you guys as well



-- 
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] pan3793 commented on pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #41062:
URL: https://github.com/apache/spark/pull/41062#issuecomment-1558897018

   Close as not required


-- 
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 #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1188150731


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {
     /**
      * Represents a table with a custom schema to use for resolving DEFAULT column references when
      * inserting into the table. For example, this can be useful for excluding hidden pseudocolumns.
      *
      * @return the new schema to use for this process.
      */
-    StructType customSchemaForInserts();
+    Column[] customColumnsForInserts();

Review Comment:
   This is a breaking change and we need to avoid 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] pan3793 closed pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite
URL: https://github.com/apache/spark/pull/41062


-- 
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] pan3793 commented on a diff in pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1197682260


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -18,21 +18,22 @@
 package org.apache.spark.sql.connector.write;
 
 import org.apache.spark.annotation.Evolving;
-import org.apache.spark.sql.types.StructType;
+import org.apache.spark.sql.connector.catalog.Column;
+import org.apache.spark.sql.connector.catalog.Table;
 
 /**
  * Trait for tables that support custom schemas for write operations including INSERT INTO commands
  * whose target table columns have explicit or implicit default values.
  *
- * @since 3.4.1
+ * @since 3.5.0

Review Comment:
   Change to 3.5.0 since it is reverted from branch-3.4



-- 
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] pan3793 commented on a diff in pull request #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1188666027


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {
     /**
      * Represents a table with a custom schema to use for resolving DEFAULT column references when
      * inserting into the table. For example, this can be useful for excluding hidden pseudocolumns.
      *
      * @return the new schema to use for this process.
      */
-    StructType customSchemaForInserts();
+    Column[] customColumnsForInserts();

Review Comment:
   Yes, it was added in https://github.com/apache/spark/pull/40996, for 3.4.1 and 3.5.0



-- 
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 #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1188151764


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {
     /**
      * Represents a table with a custom schema to use for resolving DEFAULT column references when
      * inserting into the table. For example, this can be useful for excluding hidden pseudocolumns.
      *
      * @return the new schema to use for this process.
      */
-    StructType customSchemaForInserts();
+    Column[] customColumnsForInserts();

Review Comment:
   oh it's not released yet



-- 
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 #41062: [SPARK-43313][SQL][FOLLOWUP] Improvement for DSv2 API SupportsCustomSchemaWrite

Posted by "Yikf (via GitHub)" <gi...@apache.org>.
Yikf commented on code in PR #41062:
URL: https://github.com/apache/spark/pull/41062#discussion_r1186051473


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/SupportsCustomSchemaWrite.java:
##########
@@ -27,12 +28,12 @@
  * @since 3.4.1
  */
 @Evolving
-public interface SupportsCustomSchemaWrite {
+public interface SupportsCustomSchemaWrite extends Table {

Review Comment:
   `SupportsCustomSchemaWrite` and `Table` should be independent, right? Maybe it should extend `WriteBuilder`



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