Skip to content

Conversation

@uros-db
Copy link
Contributor

@uros-db uros-db commented Dec 5, 2025

Note: experimental / draft PR.

What changes were proposed in this pull request?

Modify DROP TABLE command semantics:
DROP TABLE <view> should work on views.

Why are the changes needed?

Allow the DROP TABLE command to operate on views, to improve usability and convenience for users. Currently in Spark, attempting DROP TABLE <view> results in a WRONG_COMMAND_FOR_OBJECT_TYPE error even though the intent is unambiguous and the operation is safe. Allowing DROP TABLE to drop views simplifies user code paths by removing the need to special-case view handling in DROP statements.

Does this PR introduce any user-facing change?

Yes, the DROP TABLE <view> will now drop the VIEW, instead of returning a WRONG_COMMAND_FOR_OBJECT_TYPE error.

How was this patch tested?

Added appropriate SQL tests to verify the new behaviour.

Also, updated the existing tests to match the proposed spec.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Dec 5, 2025
@uros-db uros-db marked this pull request as draft December 5, 2025 09:16
@uros-db uros-db marked this pull request as ready for review December 5, 2025 09:38
@pan3793
Copy link
Member

pan3793 commented Dec 5, 2025

does it work on temp view and global temp view too?

@uros-db uros-db marked this pull request as draft December 5, 2025 10:00
@uros-db uros-db changed the title [DRAFT][SQL] Allow DROP TABLE to drop VIEW [WIP][DRAFT][SQL] Allow DROP TABLE to drop VIEW Dec 5, 2025
@uros-db
Copy link
Contributor Author

uros-db commented Dec 5, 2025

does it work on temp view and global temp view too?

Marked the PR as Draft for now, will get back to this a bit later.

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.

2 participants