[
https://issues.apache.org/jira/browse/CASSANDRA-19964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17902763#comment-17902763
]
Stefan Miklosovic edited comment on CASSANDRA-19964 at 12/3/24 8:35 PM:
------------------------------------------------------------------------
Hi [~maxwellguo],
I think that we could simplify that a lot (1), (2). My quick refactorings are
based on your *second* PR. We may base the "cloning" on parsing a CQL statement
of old table and just provide new keyspace and table name. The shortcoming of
the cloning like you did it is that 1) we actually do not need that 2) you are
not doing "deep copy". For example here (3) we are not copying it well enough
because you are just giving it a reference. It is not a "deep copy". If you
cloned it like that, these two TableMetadata objects would have some internal
objects in common. We want to have it totally separate.
What I would like to see is to incorporate the changes in (1) but to do it in
such a way that we will have a separate statement class as you did in your
first PR.
I have not touched the tests yet. Let's have the production code done first and
then we will be covering the tests.
(1) https://github.com/apache/cassandra/pull/3722
(2)
https://github.com/apache/cassandra/pull/3722/commits/6c59878a4eb65b83d188fba655578e081e1e5c01
(3) https://github.com/apache/cassandra/pull/3721/files#r1868306506
was (Author: smiklosovic):
Hi [~maxwellguo],
I think that we could simplify that a lot (1), (2). My quick refactorings are
based on your *second* PR. We may base the "cloning" on parsing a CQL statement
(3) of old table and just provide new keyspace and table name. The shortcoming
of the cloning like you did it is that 1) we actually do not need that 2) you
are not doing "deep copy". For example here (4) we are not copying it well
enough because you are just giving it a reference. It is not a "deep copy". If
you cloned it like that, these two TableMetadata objects would have some
internal objects in common. We want to have it totally separate.
What I would like to see is to incorporate the changes in (1) but to do it in
such a way that we will have a separate statement class as you did in your
first PR.
I have not touched the tests yet. Let's have the production code done first and
then we will be covering the tests.
(1) https://github.com/apache/cassandra/pull/3722
(2)
https://github.com/apache/cassandra/pull/3722/commits/6c59878a4eb65b83d188fba655578e081e1e5c01
(3) https://github.com/apache/cassandra/pull/3721/files#r1868306506
> CREATE TABLE LIKE for copying Basic Table definition
> -----------------------------------------------------
>
> Key: CASSANDRA-19964
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19964
> Project: Apache Cassandra
> Issue Type: New Feature
> Components: Cluster/Schema, CQL/Syntax
> Reporter: Maxwell Guo
> Assignee: Maxwell Guo
> Priority: Normal
> Fix For: 5.x
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Introduce CREATE TABLE LIKE grammar that only COPY table's basic information:
> primary key , clustering key, regular column , and their data
> types(including udt), data masking and table params , under the same keyspace
> or different keyspace.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]