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] Add rollback ddl syntax #4462

Closed
wants to merge 3 commits into from
Closed

Conversation

askwang
Copy link
Contributor

@askwang askwang commented Nov 6, 2024

Purpose

Add rollback to snapshot/tag/timestamp ddl syntax.

alter table t rollback to snapshot `2`;
alter table t rollback to tag `test-tag`;
alter table t rollback to timestamp `1730876906134`;

Tests

API and Format

Documentation

@LinMingQiang
Copy link
Contributor

Why do we need a new alter ddl syntax. Is it the same as the call procedure ?

}
case t =>
throw new UnsupportedOperationException(
s"Can not delete tag for non-paimon FileStoreTable: $t")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can not delete tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my mistake, updated, ths

@askwang
Copy link
Contributor Author

askwang commented Nov 6, 2024

Why do we need a new alter ddl syntax. Is it the same as the call procedure ?

SQL syntax support will be provided later, it is the same as procedure call.

@LinMingQiang
Copy link
Contributor

Why do we use alter table instead of call if they are the same? And alter table should be used to modify the table metadata information, like alter table add col.

@askwang
Copy link
Contributor Author

askwang commented Nov 6, 2024

Why do we use alter table instead of call if they are the same? And alter table should be used to modify the table metadata information, like alter table add col.

I think tag/snapshot are also part of the table meta info, maybe we can use alter table to modify it.

@@ -104,6 +105,12 @@ timeUnit
| MINUTES
;

kind
Copy link
Contributor

Choose a reason for hiding this comment

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

timeTravelKind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

@JingsongLi
Copy link
Contributor

Why do we use alter table instead of call if they are the same? And alter table should be used to modify the table metadata information, like alter table add col.

I agree with your idea. I have checked and currently no other lake formats have implemented custom syntax here. We can consider temporarily stopping and using CALL is not a bad idea.

@askwang What do you think?

@Zouxxyy
Copy link
Contributor

Zouxxyy commented Nov 7, 2024

In my mind, rollback should actually generate a new snapshot containing the changes, from this perspective, alter table should not be used. (although the current implementation directly deletes the existing snapshots).

Besides in spark doc description: ALTER TABLE statement changes the schema or properties of a table.

@askwang
Copy link
Contributor Author

askwang commented Nov 7, 2024

Why do we use alter table instead of call if they are the same? And alter table should be used to modify the table metadata information, like alter table add col.

I agree with your idea. I have checked and currently no other lake formats have implemented custom syntax here. We can consider temporarily stopping and using CALL is not a bad idea.

@askwang What do you think?

ok

@askwang askwang closed this Nov 7, 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.

5 participants