Preserve DESCRIBE behaviour with quoted index names for older versions

Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/afda2d45
Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/afda2d45
Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/afda2d45

Branch: refs/heads/master
Commit: afda2d45fe578359b2db51233c1f12833d8a196b
Parents: f292548
Author: Sam Tunnicliffe <[email protected]>
Authored: Fri Jan 20 12:40:59 2017 -0800
Committer: Philip Thompson <[email protected]>
Committed: Thu May 11 14:24:05 2017 -0400

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_tests.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/afda2d45/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index 7734848..4feadc1 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -682,7 +682,6 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, 
blobAsBoolean(0x), blobAsDec
         self.cluster.populate(1)
         self.cluster.start(wait_for_binary_proto=True)
         node1, = self.cluster.nodelist()
-
         self.execute(
             cql="""
                 CREATE KEYSPACE test WITH REPLICATION = {'class' : 
'SimpleStrategy', 'replication_factor' : 1};
@@ -980,10 +979,20 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, 
blobAsBoolean(0x), blobAsDec
             AND min_index_interval = 128
             AND read_repair_chance = 0.0
             AND speculative_retry = '99.0PERCENTILE';
-        """ + self.get_index_output('"QuotedNameIndex"', 'test', 'users', 
'firstname') \
+        """ + self.get_index_output('QuotedNameIndex', 'test', 'users', 
'firstname') \
                    + "\n" + self.get_index_output('myindex', 'test', 'users', 
'age')
 
     def get_index_output(self, index, ks, table, col):
+        # a quoted index name (e.g. "FooIndex") is only correctly echoed by 
DESCRIBE
+        # from 3.0.11 & 3.10
+        if index[0] == '"' and index[-1] == '"':
+            version = self.cluster.version()
+            if version >= LooseVersion('3.10'):
+                pass
+            elif LooseVersion('3.1') > version >= LooseVersion('3.0.11'):
+                pass
+            else:
+                index = index[1:-1]
         return "CREATE INDEX {} ON {}.{} ({});".format(index, ks, table, col)
 
     def get_users_by_state_mv_output(self):


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to