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

Downgrade to the minimum supported protocol when a table is using only legacy features #2750

Closed
wants to merge 1 commit into from

Conversation

zsxwing
Copy link
Member

@zsxwing zsxwing commented Mar 13, 2024

Which Delta project/connector is this regarding?

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

Description

When CDF is enabled on a table using Protocol(3, 7) without any other features, DROP FEATURE cannot downgrade the table protocol version to Protocol(1, 4).

Protocol(1, 4).implicitlySupportedFeatures always return a long list Set(org.apache.spark.sql.delta.ChangeDataFeedTableFeature$@5d56d7c5, org.apache.spark.sql.delta.CheckConstraintsTableFeature$@a7c32f7, org.apache.spark.sql.delta.InvariantsTableFeature$@10898af, org.apache.spark.sql.delta.AppendOnlyTableFeature$@760cb590, org.apache.spark.sql.delta.GeneratedColumnsTableFeature$@6a08f493) but Protocol(3,7,None,[changeDataFeed]).implicitlySupportedFeatures returns an empty set. The code requires newProtocol.implicitlySupportedFeatures must be the same as oldProtocol.implicitlySupportedFeatures. This check prevents downgrading to Protocol(1, 4).

This PR changes the check to: newProtocol.implicitlySupportedFeatures must be the superset of oldProtocol.implicitlySupportedFeatures. This will allow DROP FEATURE to downgrade the protocol further.

How was this patch tested?

The new unit test.

Does this PR introduce any user-facing changes?

Yep. DROP FEATURE can downgrade the protocol further to the right minimum required protocol of CDF or other legacy features.

@vkorukanti
Copy link
Collaborator

@xupefei Could you take a look?

@tdas tdas requested a review from bart-samwel March 13, 2024 18:10
@zsxwing
Copy link
Member Author

zsxwing commented Mar 15, 2024

Discussed offline. We may need a better solution. Closing the PR for now

@zsxwing zsxwing closed this Mar 15, 2024
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.

2 participants