[
https://issues.apache.org/jira/browse/CASSANDRA-19965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17929096#comment-17929096
]
Stefan Miklosovic commented on CASSANDRA-19965:
-----------------------------------------------
The last changes of Maxwell address the problems Sam pointed out, but there are
some cosmetic things I would like to see fixed. Consider this example:
{code}
cassandra@cqlsh> create index myindex on ks.t1(b);
cassandra@cqlsh> create table ks.t2 like ks.t1 with indexes;
cassandra@cqlsh> create table ks.t3 like ks.t2 with indexes;
cassandra@cqlsh> create table ks.t4 like ks.t3 with indexes;
cassandra@cqlsh> create table ks.t5 like ks.t4 with indexes;
cassandra@cqlsh> DESCRIBE TABLE ks.t5;
.....
CREATE INDEX myindex_1_1_1_1 ON ks.t5 (b) USING 'legacy_local_table';
{code}
Notice "_1_1_1_1" of index name. I would expect that we would be adding just
one number and the name of the index would be "myindex_5".
To fix this, we would just need to extract the name of index without the number
when doing this
{code}
else
{
indexName = findAvailableIndexName(indexMetadata.name,
indexesToCopy, targetKeyspaceMeta);
}
{code}
"indexMetadata.name" might be, for example, "myindex_1". So we just take
"myindex" and when it is passed into "findAvailableIndexName", it will look if
"myindex" exists -> it does, it is on ks.t1, so it will start to increase
suffix from _1 until it finds such a number for which "myindex_n" (n being a
number) is not taken yet.
> CREATE TABLE LIKE with INDEX / ALL option
> -------------------------------------------
>
> Key: CASSANDRA-19965
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19965
> Project: Apache Cassandra
> Issue Type: New Feature
> Components: Cluster/Schema, CQL/Syntax
> Reporter: guo Maxwell
> Assignee: guo Maxwell
> Priority: Normal
> Fix For: 5.x
>
>
> no matter Copy table with indexes or triggers under same keyspace or
> differenet.
> The indexes and trigger name should be different from the source in case of
> conflict.
> we need to
> 1.Adding cql parser for ALL/INDEX/TRIGGER when doing create table like
> 2.Automatic completion of keywords(LIKE/ALL/INDEX/TRIGGER) and function hints
> (the source table and target table explain_completion when doing table copy)
> at the cqlsh level.
> in pylib/cqlshlib/cql3handling.py and the test in
> pylib/cqlshlib/test/test_cqlsh_completion.py.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]