You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/05/22 01:53:32 UTC

[1/3] git commit: cqlsh: ninja-fix DROP INDEX autocompletion for CQL3 tables

Updated Branches:
  refs/heads/trunk 288e503d2 -> f3d2a52b9


cqlsh: ninja-fix DROP INDEX autocompletion for CQL3 tables


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

Branch: refs/heads/trunk
Commit: 687ac710cc9ec010eab6ff00dd8b6f1a3136c635
Parents: d8f0ed5
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed May 22 02:34:44 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed May 22 02:34:44 2013 +0300

----------------------------------------------------------------------
 bin/cqlsh |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/687ac710/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 974c916..2f6568a 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -669,12 +669,14 @@ class Shell(cmd.Cmd):
         return [c.name for c in self.get_columnfamilies(ksname)]
 
     def get_index_names(self, ksname=None):
-        indnames = []
-        for c in self.get_columnfamilies(ksname):
-            for md in c.column_metadata:
-                if md.index_name is not None:
-                    indnames.append(md.index_name)
-        return indnames
+        cols = []
+        if self.cqlver_atleast(3) and not self.is_cql3_beta():
+            for cfname in self.get_columnfamily_names_cql3(ksname=ksname):
+                cols.extend(self.get_columnfamily_layout(ksname, cfname).columns)
+        else:
+            for cf in self.get_columnfamilies(ksname):
+                cols.extend(cf.column_metadata)
+        return [col.index_name for col in cols if col.index_name is not None]
 
     def filterable_column_names(self, cfdef):
         filterable = set()


[3/3] git commit: cqlsh: ninja-fix DROP INDEX autocompletion for CQL3 tables (2.0)

Posted by al...@apache.org.
cqlsh: ninja-fix DROP INDEX autocompletion for CQL3 tables (2.0)


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

Branch: refs/heads/trunk
Commit: f3d2a52b99b789586363a5966a766629710bcb40
Parents: b53d3c4
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed May 22 02:53:18 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed May 22 02:53:18 2013 +0300

----------------------------------------------------------------------
 bin/cqlsh |   31 ++++++-------------------------
 1 files changed, 6 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3d2a52b/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index c7ac533..4a4fced 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -564,22 +564,6 @@ class Shell(cmd.Cmd):
     def get_keyspace_names(self):
         return [k.name for k in self.get_keyspaces()]
 
-    def get_columnfamilies(self, ksname=None):
-        if ksname is None:
-            ksname = self.current_keyspace
-            if ksname is None:
-                raise NoKeyspaceError("Not in any keyspace.")
-        return self.get_keyspace(ksname).cf_defs
-
-    def get_columnfamily(self, cfname, ksname=None):
-        if ksname is None:
-            ksname = self.current_keyspace
-        cf_defs = self.get_columnfamilies(ksname)
-        for c in cf_defs:
-            if c.name == cfname:
-                return c
-        raise ColumnFamilyNotFound("Unconfigured column family %r" % (cfname,))
-
     def get_columnfamily_names(self, ksname=None):
         if ksname is None:
             ksname = self.current_keyspace
@@ -590,16 +574,13 @@ class Shell(cmd.Cmd):
                             consistency_level='ONE')
         return [str(row[0]) for row in self.cursor.fetchall()]
 
-    # TODO: FIXME
     def get_index_names(self, ksname=None):
-        cols = []
-        if self.cqlver_atleast(3) and not self.is_cql3_beta():
-            for cfname in self.get_columnfamily_names_cql3(ksname=ksname):
-                cols.extend(self.get_columnfamily_layout(ksname, cfname).columns)
-        else:
-            for cf in self.get_columnfamilies(ksname):
-                cols.extend(cf.column_metadata)
-        return [col.index_name for col in cols if col.index_name is not None]
+        idxnames = []
+        for cfname in self.get_columnfamily_names(ksname=ksname):
+            for col in self.get_columnfamily_layout(ksname, cfname).columns:
+                if col.index_name is not None:
+                    idxnames.append(col.index_name)
+        return idxnames
 
     def get_column_names(self, ksname, cfname):
         if ksname is None:


[2/3] git commit: Merge branch 'cassandra-1.2' into trunk

Posted by al...@apache.org.
Merge branch 'cassandra-1.2' into trunk


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

Branch: refs/heads/trunk
Commit: b53d3c453b7b5b912140c3a54108057e2741c964
Parents: 288e503 687ac71
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed May 22 02:35:34 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed May 22 02:35:34 2013 +0300

----------------------------------------------------------------------
 bin/cqlsh |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b53d3c45/bin/cqlsh
----------------------------------------------------------------------
diff --cc bin/cqlsh
index 8dcc69f,2f6568a..c7ac533
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@@ -581,24 -664,31 +581,26 @@@ class Shell(cmd.Cmd)
          raise ColumnFamilyNotFound("Unconfigured column family %r" % (cfname,))
  
      def get_columnfamily_names(self, ksname=None):
 -        if self.cqlver_atleast(3) and not self.is_cql3_beta():
 -            return self.get_columnfamily_names_cql3(ksname=ksname)
 -        return [c.name for c in self.get_columnfamilies(ksname)]
 +        if ksname is None:
 +            ksname = self.current_keyspace
 +        cf_q = """select columnfamily_name from system.schema_columnfamilies
 +                   where keyspace_name=:ks"""
 +        self.cursor.execute(cf_q,
 +                            {'ks': self.cql_unprotect_name(ksname)},
 +                            consistency_level='ONE')
 +        return [str(row[0]) for row in self.cursor.fetchall()]
  
 +    # TODO: FIXME
      def get_index_names(self, ksname=None):
-         indnames = []
-         for c in self.get_columnfamilies(ksname):
-             for md in c.column_metadata:
-                 if md.index_name is not None:
-                     indnames.append(md.index_name)
-         return indnames
+         cols = []
+         if self.cqlver_atleast(3) and not self.is_cql3_beta():
+             for cfname in self.get_columnfamily_names_cql3(ksname=ksname):
+                 cols.extend(self.get_columnfamily_layout(ksname, cfname).columns)
+         else:
+             for cf in self.get_columnfamilies(ksname):
+                 cols.extend(cf.column_metadata)
+         return [col.index_name for col in cols if col.index_name is not None]
  
 -    def filterable_column_names(self, cfdef):
 -        filterable = set()
 -        if cfdef.key_alias is not None and cfdef.key_alias != 'KEY':
 -            filterable.add(cfdef.key_alias)
 -        else:
 -            filterable.add('KEY')
 -        for cm in cfdef.column_metadata:
 -            if cm.index_name is not None:
 -                filterable.add(cm.name)
 -        return filterable
 -
      def get_column_names(self, ksname, cfname):
          if ksname is None:
              ksname = self.current_keyspace