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] Drop Type Widening Table Feature #2720

Merged

Conversation

johanl-db
Copy link
Collaborator

@johanl-db johanl-db commented Mar 5, 2024

This PR includes changes from #2708 which isn't merged yet.
The changes related only to dropping the table feature are in commit e2601a6

Description

This change is part of the type widening table feature.
Type widening feature request: #2622
Type Widening protocol RFC: #2624

It adds the ability to remove the type widening table feature by running the ALTER TABLE DROP FEATURE command.
Before dropping the table feature, traces of it are removed from the current version of the table:

  • Files that were written before the latest type change and thus contain types that differ from the current table schema are rewritten using an internal REORG TABLE operation.
  • Metadata in the table schema recording previous type changes is removed.

How was this patch tested?

  • A new set of tests are added to DeltaTypeWideningSuite to cover dropping the table feature with tables in various states: with/without files to rewrite or metadata to remove.

Does this PR introduce any user-facing changes?

The table feature is available in testing only, there's no user-facing changes as of now.

When the feature is available, this change enables the following user action:

  • Drop the type widening table feature:
ALTER TABLE t DROP FEATURE typeWidening

This succeeds immediately if no version of the table contains traces of the table feature (= no type changes were applied in the available history of the table.
Otherwise, if the current version contains traces of the feature, these are removed: files are rewritten if needed and type widening metadata is removed from the table schema. Then, an error DELTA_FEATURE_DROP_WAIT_FOR_RETENTION_PERIOD is thrown, telling the user to retry once the retention period expires.

If only previous versions contain traces of the feature, no action is applied on the table, and an error DELTA_FEATURE_DROP_HISTORICAL_VERSIONS_EXIST is thrown, telling the user to retry once the retention period expires.

@johanl-db johanl-db self-assigned this Mar 15, 2024
@sabir-akhadov
Copy link
Contributor

| This PR includes changes from #2708 which isn't merged yet.
I believe it is now?

Copy link
Contributor

@sabir-akhadov sabir-akhadov left a comment

Choose a reason for hiding this comment

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

lgtm

@vkorukanti vkorukanti changed the title Drop Type Widening Table Feature [Spark] Drop Type Widening Table Feature Mar 15, 2024
@vkorukanti vkorukanti merged commit ec8ab16 into delta-io:master Mar 15, 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