Skip to content

Conversation

@Hisoka-X
Copy link
Member

@Hisoka-X Hisoka-X commented Jun 28, 2023

What changes were proposed in this pull request?

cherry pick #41348 and #42056 , this a bug fixed should be included in 3.4.2

Why are the changes needed?

Fix DROP table behavior in session catalog

Does this PR introduce any user-facing change?

No

How was this patch tested?

Tested by:

  • V2 table catalog tests: org.apache.spark.sql.execution.command.v2.DropTableSuite
  • V1 table catalog tests: org.apache.spark.sql.execution.command.v1.DropTableSuiteBase

@github-actions github-actions bot added the SQL label Jun 28, 2023
@Hisoka-X
Copy link
Member Author

cc @cloud-fan @viirya @aokolnychyi

@beliefer
Copy link
Contributor

Spark will discard the v1 API ?

@Hisoka-X
Copy link
Member Author

Spark will discard the v1 API ?

Not, this is a bug fix for drop table case, please refer #41348

@holdenk holdenk requested a review from cloud-fan July 8, 2023 23:43
@holdenk
Copy link
Contributor

holdenk commented Jul 8, 2023

@aokolnychyi since you asked for the backport maybe good to take a look.

@Hisoka-X
Copy link
Member Author

I also bring #42056 to backport. @cloud-fan PTAL. Thank!

Hisoka-X and others added 2 commits August 29, 2023 17:04
<!--
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?
In order to fix DROP table behavior in session catalog cause by apache#37879. Because we always invoke V1 drop logic if the identifier looks like a V1 identifier. This is a big blocker for external data sources that provide custom session catalogs.
So this PR move all Drop Table case to DataSource V2 (use drop table to drop view not include). More information please check https://github.com/apache/spark/pull/37879/files#r1170501180

<!--
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.
  3. If you fix some SQL features, you can provide some references of other DBMSes.
  4. If there is design documentation, please add the link.
  5. If there is a discussion in the mailing list, please add the link.
-->

### Why are the changes needed?
Move Drop Table case to DataSource V2 to fix bug and prepare for remove drop table v1.
<!--
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?
No
<!--
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?
Tested by:
- V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropTableSuite`
- V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropTableSuiteBase`
<!--
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.
-->

Closes apache#41348 from Hisoka-X/SPARK-43203_drop_table_to_v2.

Authored-by: Jia Fan <fanjiaeminem@qq.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>

(cherry picked from commit 32a5db4)
… null table

### What changes were proposed in this pull request?

This is a followup of apache#41348 . Previously `V2SessionCatalog.dropTable` treated null table as table not exists, but apache#41348 broke it. This PR fixes it.

### Why are the changes needed?

to keep old behavior.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

existing tests

Closes apache#42056 from cloud-fan/mm.

Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Kent Yao <yao@apache.org>
(cherry picked from commit 704131b)
@Hisoka-X Hisoka-X force-pushed the move_drop_table_v2_to_3.4.2 branch from 7246ee9 to c6524c6 Compare August 29, 2023 09:06
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @Hisoka-X and all.

Also, cc @viirya .

Merged to branch-3.4 for Apache Spark 3.4.2.

dongjoon-hyun pushed a commit that referenced this pull request Sep 8, 2023
### What changes were proposed in this pull request?
cherry pick #41348 and #42056 , this a bug fixed should be included in 3.4.2

### Why are the changes needed?
Fix DROP table behavior in session catalog

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Tested by:
- V2 table catalog tests: `org.apache.spark.sql.execution.command.v2.DropTableSuite`
- V1 table catalog tests: `org.apache.spark.sql.execution.command.v1.DropTableSuiteBase`

Closes #41765 from Hisoka-X/move_drop_table_v2_to_3.4.2.

Lead-authored-by: Jia Fan <fanjiaeminem@qq.com>
Co-authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
@viirya
Copy link
Member

viirya commented Sep 8, 2023

lgtm

@Hisoka-X
Copy link
Member Author

Thanks all!

@Hisoka-X Hisoka-X deleted the move_drop_table_v2_to_3.4.2 branch September 12, 2023 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants