Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spark] Fix char/varchar to string column conversions #2731

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

dhruvarya-db
Copy link
Collaborator

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

Users are currently allowed to change the data type of their columns from char/varchar to string. Even though the command succeeds, the column metadata that indicates that the column is char/varchar is not removed during the process. As a result, Delta enforces the old char/varchar constraints on future inserts.

This PR fixes that by removing this metadata from any updated char/varchar column when the column is updated.

How was this patch tested?

Added a new test which was failing without the code fix.

Does this PR introduce any user-facing changes?

Yes, ALTER COLUMN X TYPE STRING; will now work correctly when X is char/varchar.

@dhruvarya-db dhruvarya-db force-pushed the alter-column-fix-chrToStr branch from 9262713 to 17e78f5 Compare March 14, 2024 01:27
@prakharjain09 prakharjain09 self-requested a review March 14, 2024 01:28
@vkorukanti vkorukanti merged commit 9a59c0a into delta-io:master Mar 14, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants