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

CASSANDRA-19964 second approach - CREATE TABLE LIKE for copying Basic Table definition using create table parser #3721

Closed

Conversation

Maxwell-Guo
Copy link
Contributor

This is for CASSANDRA-19664:
1、we can copy table under the same keyspace of under different keysapces.
2、only support basic table schema : primary key(partition key and clustering key), regular columns , static columns, column masking, table params(compaction, compression and so on).

@ciphx
Copy link

ciphx commented Dec 3, 2024

Hello, can i take up this issue?

@smiklosovic smiklosovic changed the title CREATE TABLE LIKE for copying Basic Table definition using create table parser CASSANDRA-19964 CREATE TABLE LIKE for copying Basic Table definition using create table parser Dec 3, 2024
@smiklosovic smiklosovic changed the title CASSANDRA-19964 CREATE TABLE LIKE for copying Basic Table definition using create table parser CASSANDRA-19964 first approach - CREATE TABLE LIKE for copying Basic Table definition using create table parser Dec 3, 2024
@smiklosovic smiklosovic changed the title CASSANDRA-19964 first approach - CREATE TABLE LIKE for copying Basic Table definition using create table parser CASSANDRA-19964 second approach - CREATE TABLE LIKE for copying Basic Table definition using create table parser Dec 3, 2024
@smiklosovic smiklosovic self-requested a review December 3, 2024 18:18
@@ -208,6 +208,11 @@ public ColumnMetadata(String ksName,
this.mask = mask;
}

protected ColumnMetadata cloneWithoutTableName(String keyspace, String table)
{
return new ColumnMetadata(keyspace, table, name, type, position, kind, mask);
Copy link
Contributor

@smiklosovic smiklosovic Dec 3, 2024

Choose a reason for hiding this comment

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

this is not a good idea, we are not copying it "deep enough".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, you are right.

@Maxwell-Guo
Copy link
Contributor Author

Hello, can i take up this issue?

feel free to left your review comments

}

@Override
public void validate(ClientState state)
{
super.validate(state);

if (isCreateLike)
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be all added to your new PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copytablestatement only deal with create table like CQL, so we may do not need this .
for cql like create table if not exist ta like tb, there will be a SyntaxException. I have a test for this in CreateLikeCqlParseTest

@Maxwell-Guo Maxwell-Guo force-pushed the CASSANDRA-19964-like-parse branch from f301539 to a5448b0 Compare January 7, 2025 13:30
@Maxwell-Guo Maxwell-Guo force-pushed the CASSANDRA-19964-like-parse branch from a5448b0 to e4d8031 Compare January 7, 2025 13:38
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