bbotella commented on code in PR #3831: URL: https://github.com/apache/cassandra/pull/3831#discussion_r1949177228
########## doc/cql3/CQL.textile: ########## @@ -438,7 +441,7 @@ The old table name defines the already existed table. h4(#copyTableOptions). @<copyoptions>@ -The @COPY TABLE@ statement supports a number of options that controls the configuration of a new table. These options can be specified after the @WITH@ keyword, and all options are the same as those options when creating a table except for id . +The @COPY TABLE@ statement supports a number of options that controls the configuration of a new table. These options can be specified after the @WITH@ keyword, and all options are the same as those options when creating a table except for id .Besides the options can also be specified with keyword INDEXES which means copy source table's indexes. Review Comment: ```suggestion The @COPY TABLE@ statement supports a number of options that controls the configuration of a new table. These options can be specified after the @WITH@ keyword, and all options are the same as those options when creating a table except for id. Besides the options can also be specified with keyword INDEXES which means copy source table's indexes. ``` ########## pylib/cqlshlib/test/test_cqlsh_completion.py: ########## @@ -808,23 +808,18 @@ def test_complete_in_create_table_like(self): 'memtable', 'memtable_flush_period_in_ms', 'caching', 'comment', - 'min_index_interval', 'speculative_retry', 'additional_write_policy', 'cdc', 'read_repair']) - self.trycompletions('CREATE TABLE ' + 'new_table LIKE old_table WITH ', - choices=['allow_auto_snapshot', - 'bloom_filter_fp_chance', 'compaction', - 'compression', - 'default_time_to_live', 'gc_grace_seconds', - 'incremental_backups', - 'max_index_interval', - 'memtable', - 'memtable_flush_period_in_ms', - 'caching', 'comment', - 'min_index_interval', 'speculative_retry', 'additional_write_policy', 'cdc', 'read_repair']) + 'min_index_interval', + 'speculative_retry', 'additional_write_policy', + 'cdc', 'read_repair', + 'ALL']) + self.trycompletions('CREATE TABLE new_table LIKE old_table WITH ALL ', + choices=['<identifier>', '=']) Review Comment: Curious. Why `=` is a choice here? ########## test/unit/org/apache/cassandra/schema/createlike/CreateLikeTest.java: ########## @@ -244,60 +248,59 @@ public void testCopyAfterAlterTable() row(1, "1", duration1, uuid1)); assertRows(execute("SELECT * FROM " + targetKs + "." + targetTb), row(2, "2", duration2, uuid2)); - } @Test public void testTableOptionsCopy() throws Throwable { // compression String tbCompressionDefault1 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))"); - String tbCompressionDefault2 =createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'enabled' : 'false'};"); + String tbCompressionDefault2 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'enabled' : 'false'};"); String tbCompressionSnappy1 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 };"); - String tbCompressionSnappy2 =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32, 'enabled' : true };"); - String tbCompressionSnappy3 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 2 };"); - String tbCompressionSnappy4 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 1 };"); - String tbCompressionSnappy5 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 0 };"); + " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 };"); + String tbCompressionSnappy2 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32, 'enabled' : true };"); + String tbCompressionSnappy3 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 2 };"); + String tbCompressionSnappy4 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 1 };"); + String tbCompressionSnappy5 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 0 };"); // memtable - String tableMemtableSkipList = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'skiplist';"); - String tableMemtableTrie = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'trie';"); - String tableMemtableDefault = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'default';"); + String tableMemtableSkipList = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'skiplist';"); + String tableMemtableTrie = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'trie';"); + String tableMemtableDefault = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'default';"); // compaction - String tableCompactionStcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'SizeTieredCompactionStrategy', 'min_threshold':2, 'enabled':false};"); - String tableCompactionLcs =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'LeveledCompactionStrategy', 'sstable_size_in_mb':1, 'fanout_size':5};"); + String tableCompactionStcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'SizeTieredCompactionStrategy', 'min_threshold':2, 'enabled':false};"); + String tableCompactionLcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'LeveledCompactionStrategy', 'sstable_size_in_mb':1, 'fanout_size':5};"); String tableCompactionTwcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'TimeWindowCompactionStrategy', 'min_threshold':2};"); - String tableCompactionUcs =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'UnifiedCompactionStrategy'};"); + String tableCompactionUcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'UnifiedCompactionStrategy'};"); // other options are all different from default String tableOtherOptions = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH" + - " additional_write_policy = '95p' " + - " AND bloom_filter_fp_chance = 0.1 " + - " AND caching = {'keys': 'ALL', 'rows_per_partition': '100'}" + - " AND cdc = true " + - " AND comment = 'test for create like'" + - " AND crc_check_chance = 0.1" + - " AND default_time_to_live = 10" + - " AND compaction = {'class':'UnifiedCompactionStrategy'} " + - " AND compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 }" + - " AND gc_grace_seconds = 100" + - " AND incremental_backups = false" + - " AND max_index_interval = 1024" + - " AND min_index_interval = 64" + - " AND speculative_retry = '95p'" + - " AND read_repair = 'NONE'" + - " AND memtable_flush_period_in_ms = 360000" + - " AND memtable = 'default';" ); + " additional_write_policy = '95p' " + + " AND bloom_filter_fp_chance = 0.1 " + + " AND caching = {'keys': 'ALL', 'rows_per_partition': '100'}" + + " AND cdc = true " + + " AND comment = 'test for create like'" + + " AND crc_check_chance = 0.1" + + " AND default_time_to_live = 10" + + " AND compaction = {'class':'UnifiedCompactionStrategy'} " + Review Comment: ```suggestion " AND compaction = {'class': 'UnifiedCompactionStrategy'} " + ``` ########## test/unit/org/apache/cassandra/schema/createlike/CreateLikeTest.java: ########## @@ -244,60 +248,59 @@ public void testCopyAfterAlterTable() row(1, "1", duration1, uuid1)); assertRows(execute("SELECT * FROM " + targetKs + "." + targetTb), row(2, "2", duration2, uuid2)); - } @Test public void testTableOptionsCopy() throws Throwable { // compression String tbCompressionDefault1 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))"); - String tbCompressionDefault2 =createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'enabled' : 'false'};"); + String tbCompressionDefault2 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'enabled' : 'false'};"); String tbCompressionSnappy1 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 };"); - String tbCompressionSnappy2 =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32, 'enabled' : true };"); - String tbCompressionSnappy3 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 2 };"); - String tbCompressionSnappy4 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 1 };"); - String tbCompressionSnappy5 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 0 };"); + " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 };"); + String tbCompressionSnappy2 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32, 'enabled' : true };"); + String tbCompressionSnappy3 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 2 };"); + String tbCompressionSnappy4 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 1 };"); + String tbCompressionSnappy5 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 0 };"); // memtable - String tableMemtableSkipList = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'skiplist';"); - String tableMemtableTrie = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'trie';"); - String tableMemtableDefault = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'default';"); + String tableMemtableSkipList = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'skiplist';"); + String tableMemtableTrie = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'trie';"); + String tableMemtableDefault = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'default';"); // compaction - String tableCompactionStcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'SizeTieredCompactionStrategy', 'min_threshold':2, 'enabled':false};"); - String tableCompactionLcs =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'LeveledCompactionStrategy', 'sstable_size_in_mb':1, 'fanout_size':5};"); + String tableCompactionStcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'SizeTieredCompactionStrategy', 'min_threshold':2, 'enabled':false};"); + String tableCompactionLcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'LeveledCompactionStrategy', 'sstable_size_in_mb':1, 'fanout_size':5};"); String tableCompactionTwcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'TimeWindowCompactionStrategy', 'min_threshold':2};"); - String tableCompactionUcs =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'UnifiedCompactionStrategy'};"); + String tableCompactionUcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'UnifiedCompactionStrategy'};"); // other options are all different from default String tableOtherOptions = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH" + - " additional_write_policy = '95p' " + - " AND bloom_filter_fp_chance = 0.1 " + - " AND caching = {'keys': 'ALL', 'rows_per_partition': '100'}" + - " AND cdc = true " + - " AND comment = 'test for create like'" + - " AND crc_check_chance = 0.1" + - " AND default_time_to_live = 10" + - " AND compaction = {'class':'UnifiedCompactionStrategy'} " + - " AND compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 }" + - " AND gc_grace_seconds = 100" + - " AND incremental_backups = false" + - " AND max_index_interval = 1024" + - " AND min_index_interval = 64" + - " AND speculative_retry = '95p'" + - " AND read_repair = 'NONE'" + - " AND memtable_flush_period_in_ms = 360000" + - " AND memtable = 'default';" ); + " additional_write_policy = '95p' " + + " AND bloom_filter_fp_chance = 0.1 " + + " AND caching = {'keys': 'ALL', 'rows_per_partition': '100'}" + + " AND cdc = true " + + " AND comment = 'test for create like'" + + " AND crc_check_chance = 0.1" + + " AND default_time_to_live = 10" + + " AND compaction = {'class':'UnifiedCompactionStrategy'} " + + " AND compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 }" + Review Comment: Please review other similar extra/missing spaces ########## test/unit/org/apache/cassandra/schema/createlike/CreateLikeTest.java: ########## @@ -244,60 +248,59 @@ public void testCopyAfterAlterTable() row(1, "1", duration1, uuid1)); assertRows(execute("SELECT * FROM " + targetKs + "." + targetTb), row(2, "2", duration2, uuid2)); - } @Test public void testTableOptionsCopy() throws Throwable { // compression String tbCompressionDefault1 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))"); - String tbCompressionDefault2 =createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'enabled' : 'false'};"); + String tbCompressionDefault2 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'enabled' : 'false'};"); String tbCompressionSnappy1 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 };"); - String tbCompressionSnappy2 =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32, 'enabled' : true };"); - String tbCompressionSnappy3 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 2 };"); - String tbCompressionSnappy4 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 1 };"); - String tbCompressionSnappy5 = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 0 };"); + " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 };"); + String tbCompressionSnappy2 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32, 'enabled' : true };"); + String tbCompressionSnappy3 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 2 };"); + String tbCompressionSnappy4 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 1 };"); + String tbCompressionSnappy5 = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH compression = { 'class' : 'SnappyCompressor', 'min_compress_ratio' : 0 };"); // memtable - String tableMemtableSkipList = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'skiplist';"); - String tableMemtableTrie = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'trie';"); - String tableMemtableDefault = createTable(sourceKs,"CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + - " WITH memtable = 'default';"); + String tableMemtableSkipList = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'skiplist';"); + String tableMemtableTrie = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'trie';"); + String tableMemtableDefault = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b))" + + " WITH memtable = 'default';"); // compaction - String tableCompactionStcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'SizeTieredCompactionStrategy', 'min_threshold':2, 'enabled':false};"); - String tableCompactionLcs =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'LeveledCompactionStrategy', 'sstable_size_in_mb':1, 'fanout_size':5};"); + String tableCompactionStcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'SizeTieredCompactionStrategy', 'min_threshold':2, 'enabled':false};"); + String tableCompactionLcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'LeveledCompactionStrategy', 'sstable_size_in_mb':1, 'fanout_size':5};"); String tableCompactionTwcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'TimeWindowCompactionStrategy', 'min_threshold':2};"); - String tableCompactionUcs =createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'UnifiedCompactionStrategy'};"); + String tableCompactionUcs = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH compaction = {'class':'UnifiedCompactionStrategy'};"); // other options are all different from default String tableOtherOptions = createTable(sourceKs, "CREATE TABLE %s (a text, b int, c int, primary key (a, b)) WITH" + - " additional_write_policy = '95p' " + - " AND bloom_filter_fp_chance = 0.1 " + - " AND caching = {'keys': 'ALL', 'rows_per_partition': '100'}" + - " AND cdc = true " + - " AND comment = 'test for create like'" + - " AND crc_check_chance = 0.1" + - " AND default_time_to_live = 10" + - " AND compaction = {'class':'UnifiedCompactionStrategy'} " + - " AND compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 }" + - " AND gc_grace_seconds = 100" + - " AND incremental_backups = false" + - " AND max_index_interval = 1024" + - " AND min_index_interval = 64" + - " AND speculative_retry = '95p'" + - " AND read_repair = 'NONE'" + - " AND memtable_flush_period_in_ms = 360000" + - " AND memtable = 'default';" ); + " additional_write_policy = '95p' " + + " AND bloom_filter_fp_chance = 0.1 " + + " AND caching = {'keys': 'ALL', 'rows_per_partition': '100'}" + + " AND cdc = true " + + " AND comment = 'test for create like'" + + " AND crc_check_chance = 0.1" + + " AND default_time_to_live = 10" + + " AND compaction = {'class':'UnifiedCompactionStrategy'} " + + " AND compression = { 'class' : 'SnappyCompressor', 'chunk_length_in_kb' : 32 }" + Review Comment: ```suggestion " AND compression = { 'class': 'SnappyCompressor', 'chunk_length_in_kb': 32 }" + ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org