spark icon indicating copy to clipboard operation
spark copied to clipboard

[WIP][DRAFT][SQL] Allow DROP TABLE to drop VIEW

Open uros-db opened this issue 1 month ago • 2 comments

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.

uros-db avatar Dec 05 '25 09:12 uros-db

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

pan3793 avatar Dec 05 '25 09:12 pan3793

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.

uros-db avatar Dec 05 '25 10:12 uros-db