|
19 | 19 | package org.apache.cassandra.schema; |
20 | 20 |
|
21 | 21 | import org.apache.cassandra.cql3.CQLTester; |
| 22 | +import org.apache.cassandra.cql3.UntypedResultSet; |
22 | 23 | import org.apache.cassandra.exceptions.ConfigurationException; |
23 | 24 | import org.apache.cassandra.exceptions.InvalidRequestException; |
24 | 25 |
|
25 | 26 | import org.junit.Test; |
26 | 27 |
|
| 28 | +import static org.assertj.core.api.Assertions.assertThat; |
27 | 29 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
28 | 30 | import static org.junit.Assert.fail; |
29 | 31 |
|
@@ -100,6 +102,25 @@ public void testCreateTableWithMissingClusteringColumn() |
100 | 102 | "Missing CLUSTERING ORDER for column ck1"); |
101 | 103 | } |
102 | 104 |
|
| 105 | + @Test |
| 106 | + public void testCreatingTableWithLongName() throws Throwable |
| 107 | + { |
| 108 | + String keyspace = "g38373639353166362d356631322d343864652d393063362d653862616534343165333764_tpch"; |
| 109 | + String table = "test_create_k8yq1r75bpzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"; |
| 110 | + |
| 111 | + execute(String.format("CREATE KEYSPACE %s with replication = " + |
| 112 | + "{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 }", |
| 113 | + keyspace)); |
| 114 | + createTableMayThrow(String.format("CREATE TABLE %s.%s (" + |
| 115 | + "key int PRIMARY KEY," + |
| 116 | + "val int)", keyspace, table)); |
| 117 | + |
| 118 | + execute(String.format("INSERT INTO %s.%s (key,val) VALUES (1,1)", keyspace, table)); |
| 119 | + flush(keyspace, table); |
| 120 | + UntypedResultSet result = execute(String.format("SELECT * from %s.%s", keyspace, table)); |
| 121 | + assertThat(result.size()).isEqualTo(1); |
| 122 | + } |
| 123 | + |
103 | 124 | private void expectedFailure(String statement, String errorMsg) |
104 | 125 | { |
105 | 126 |
|
|
0 commit comments