You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jm...@apache.org on 2015/12/01 19:57:44 UTC

[01/13] cassandra git commit: Fix completion problems in cqlsh

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 8738087ed -> 1b81ad19d
  refs/heads/cassandra-3.0 3864b2114 -> 803a3d901
  refs/heads/cassandra-3.1 60aeef3d6 -> 6bda8868c
  refs/heads/trunk 7c3e0b191 -> 5daf8d020


Fix completion problems in cqlsh

Patch by stefania; reviewed by pmotta for CASSANDRA-10753


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

Branch: refs/heads/cassandra-2.2
Commit: 1b81ad19d33710bfa1724262f76cd3cd8114b162
Parents: 8738087
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:52:09 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:52:09 2015 -0500

----------------------------------------------------------------------
 bin/cqlsh.py                                    |   2 +-
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-c535450.zip | Bin 233938 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  11 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 6 files changed, 25 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 027a45e..a5a2bfa 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -2330,7 +2330,7 @@ class ImportProcess(mp.Process):
         table_meta = new_cluster.metadata.keyspaces[self.ks].tables[self.cf]
 
         pk_cols = [col.name for col in table_meta.primary_key]
-        cqltypes = [table_meta.columns[name].typestring for name in self.columns]
+        cqltypes = [table_meta.columns[name].cql_type for name in self.columns]
         pk_indexes = [self.columns.index(col.name) for col in table_meta.primary_key]
         is_counter_table = ("counter" in cqltypes)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
deleted file mode 100644
index 9c75cd6..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index aed7d01..4c21f7a 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -767,21 +767,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -830,16 +829,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -899,29 +898,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -947,7 +945,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1174,8 +1172,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 7cf583d..e5eb9e1 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -654,7 +654,8 @@ class TestCqlshCompletion(CqlshCompletionCase):
                             choices=['base_time_seconds', 'max_sstable_age_days',
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
-                                    'enabled', 'unchecked_tombstone_compaction'])
+                                    'enabled', 'unchecked_tombstone_compaction',
+                                    'max_window_size_seconds'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 3246541..7a2fc86 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[09/13] cassandra git commit: 10753-3.0 patch

Posted by jm...@apache.org.
10753-3.0 patch


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

Branch: refs/heads/trunk
Commit: 803a3d901141dcef4bcfce78b568300b283713e4
Parents: 25a1e89
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:56:03 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:56:03 2015 -0500

----------------------------------------------------------------------
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-3f15725.zip | Bin 234113 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  10 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 5 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip
deleted file mode 100644
index b9afb58..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 9ba4122..25cf427 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -787,21 +787,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -850,16 +849,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -919,29 +918,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -967,7 +965,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1199,8 +1197,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 84d7ca6..3596a75 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -656,7 +656,7 @@ class TestCqlshCompletion(CqlshCompletionCase):
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
                                     'enabled', 'unchecked_tombstone_compaction',
-                                    'only_purge_repaired_tombstones'])
+                                    'max_window_size_seconds', 'only_purge_repaired_tombstones'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 7a1481c..cfaa395 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[02/13] cassandra git commit: Fix completion problems in cqlsh

Posted by jm...@apache.org.
Fix completion problems in cqlsh

Patch by stefania; reviewed by pmotta for CASSANDRA-10753


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

Branch: refs/heads/trunk
Commit: 1b81ad19d33710bfa1724262f76cd3cd8114b162
Parents: 8738087
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:52:09 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:52:09 2015 -0500

----------------------------------------------------------------------
 bin/cqlsh.py                                    |   2 +-
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-c535450.zip | Bin 233938 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  11 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 6 files changed, 25 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 027a45e..a5a2bfa 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -2330,7 +2330,7 @@ class ImportProcess(mp.Process):
         table_meta = new_cluster.metadata.keyspaces[self.ks].tables[self.cf]
 
         pk_cols = [col.name for col in table_meta.primary_key]
-        cqltypes = [table_meta.columns[name].typestring for name in self.columns]
+        cqltypes = [table_meta.columns[name].cql_type for name in self.columns]
         pk_indexes = [self.columns.index(col.name) for col in table_meta.primary_key]
         is_counter_table = ("counter" in cqltypes)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
deleted file mode 100644
index 9c75cd6..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index aed7d01..4c21f7a 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -767,21 +767,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -830,16 +829,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -899,29 +898,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -947,7 +945,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1174,8 +1172,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 7cf583d..e5eb9e1 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -654,7 +654,8 @@ class TestCqlshCompletion(CqlshCompletionCase):
                             choices=['base_time_seconds', 'max_sstable_age_days',
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
-                                    'enabled', 'unchecked_tombstone_compaction'])
+                                    'enabled', 'unchecked_tombstone_compaction',
+                                    'max_window_size_seconds'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 3246541..7a2fc86 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[10/13] cassandra git commit: 10753-3.0 patch

Posted by jm...@apache.org.
10753-3.0 patch


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

Branch: refs/heads/cassandra-3.0
Commit: 803a3d901141dcef4bcfce78b568300b283713e4
Parents: 25a1e89
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:56:03 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:56:03 2015 -0500

----------------------------------------------------------------------
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-3f15725.zip | Bin 234113 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  10 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 5 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip
deleted file mode 100644
index b9afb58..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 9ba4122..25cf427 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -787,21 +787,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -850,16 +849,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -919,29 +918,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -967,7 +965,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1199,8 +1197,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 84d7ca6..3596a75 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -656,7 +656,7 @@ class TestCqlshCompletion(CqlshCompletionCase):
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
                                     'enabled', 'unchecked_tombstone_compaction',
-                                    'only_purge_repaired_tombstones'])
+                                    'max_window_size_seconds', 'only_purge_repaired_tombstones'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 7a1481c..cfaa395 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[11/13] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.1

Posted by jm...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.1


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

Branch: refs/heads/cassandra-3.1
Commit: 6bda8868caedc831767e7de398e9d3be53142a11
Parents: 60aeef3 803a3d9
Author: Joshua McKenzie <jm...@apache.org>
Authored: Tue Dec 1 13:56:25 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:56:25 2015 -0500

----------------------------------------------------------------------
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-3f15725.zip | Bin 234113 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  10 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 5 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------



[05/13] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by jm...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.1
Commit: 25a1e8960cdc7c7558e1ec7e34e7b8e22cfde152
Parents: 3864b21 1b81ad1
Author: Joshua McKenzie <jm...@apache.org>
Authored: Tue Dec 1 13:55:07 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:55:07 2015 -0500

----------------------------------------------------------------------

----------------------------------------------------------------------



[04/13] cassandra git commit: Fix completion problems in cqlsh

Posted by jm...@apache.org.
Fix completion problems in cqlsh

Patch by stefania; reviewed by pmotta for CASSANDRA-10753


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

Branch: refs/heads/cassandra-3.1
Commit: 1b81ad19d33710bfa1724262f76cd3cd8114b162
Parents: 8738087
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:52:09 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:52:09 2015 -0500

----------------------------------------------------------------------
 bin/cqlsh.py                                    |   2 +-
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-c535450.zip | Bin 233938 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  11 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 6 files changed, 25 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 027a45e..a5a2bfa 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -2330,7 +2330,7 @@ class ImportProcess(mp.Process):
         table_meta = new_cluster.metadata.keyspaces[self.ks].tables[self.cf]
 
         pk_cols = [col.name for col in table_meta.primary_key]
-        cqltypes = [table_meta.columns[name].typestring for name in self.columns]
+        cqltypes = [table_meta.columns[name].cql_type for name in self.columns]
         pk_indexes = [self.columns.index(col.name) for col in table_meta.primary_key]
         is_counter_table = ("counter" in cqltypes)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
deleted file mode 100644
index 9c75cd6..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index aed7d01..4c21f7a 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -767,21 +767,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -830,16 +829,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -899,29 +898,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -947,7 +945,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1174,8 +1172,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 7cf583d..e5eb9e1 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -654,7 +654,8 @@ class TestCqlshCompletion(CqlshCompletionCase):
                             choices=['base_time_seconds', 'max_sstable_age_days',
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
-                                    'enabled', 'unchecked_tombstone_compaction'])
+                                    'enabled', 'unchecked_tombstone_compaction',
+                                    'max_window_size_seconds'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 3246541..7a2fc86 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[08/13] cassandra git commit: 10753-3.0 patch

Posted by jm...@apache.org.
10753-3.0 patch


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

Branch: refs/heads/cassandra-3.1
Commit: 803a3d901141dcef4bcfce78b568300b283713e4
Parents: 25a1e89
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:56:03 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:56:03 2015 -0500

----------------------------------------------------------------------
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-3f15725.zip | Bin 234113 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  10 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 5 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip
deleted file mode 100644
index b9afb58..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-3f15725.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 9ba4122..25cf427 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -787,21 +787,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -850,16 +849,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -919,29 +918,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -967,7 +965,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1199,8 +1197,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 84d7ca6..3596a75 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -656,7 +656,7 @@ class TestCqlshCompletion(CqlshCompletionCase):
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
                                     'enabled', 'unchecked_tombstone_compaction',
-                                    'only_purge_repaired_tombstones'])
+                                    'max_window_size_seconds', 'only_purge_repaired_tombstones'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/803a3d90/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 7a1481c..cfaa395 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[03/13] cassandra git commit: Fix completion problems in cqlsh

Posted by jm...@apache.org.
Fix completion problems in cqlsh

Patch by stefania; reviewed by pmotta for CASSANDRA-10753


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

Branch: refs/heads/cassandra-3.0
Commit: 1b81ad19d33710bfa1724262f76cd3cd8114b162
Parents: 8738087
Author: Stefania <st...@datastax.com>
Authored: Tue Dec 1 13:52:09 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:52:09 2015 -0500

----------------------------------------------------------------------
 bin/cqlsh.py                                    |   2 +-
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-c535450.zip | Bin 233938 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  11 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 6 files changed, 25 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 027a45e..a5a2bfa 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -2330,7 +2330,7 @@ class ImportProcess(mp.Process):
         table_meta = new_cluster.metadata.keyspaces[self.ks].tables[self.cf]
 
         pk_cols = [col.name for col in table_meta.primary_key]
-        cqltypes = [table_meta.columns[name].typestring for name in self.columns]
+        cqltypes = [table_meta.columns[name].cql_type for name in self.columns]
         pk_indexes = [self.columns.index(col.name) for col in table_meta.primary_key]
         is_counter_table = ("counter" in cqltypes)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip
new file mode 100644
index 0000000..507370b
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip b/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip
deleted file mode 100644
index 9c75cd6..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a3.post0-c535450.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index aed7d01..4c21f7a 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -767,21 +767,20 @@ def relation_token_subject_completer(ctxt, cass):
 @completer_for('relation', 'rel_lhs')
 def select_relation_lhs_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
-    filterable = set((layout.partition_key[0].name, layout.clustering_key[0].name))
+    filterable = set()
     already_filtered_on = map(dequote_name, ctxt.get_binding('rel_lhs', ()))
-    for num in range(1, len(layout.partition_key)):
-        if layout.partition_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.partition_key)):
+        if num == 0 or layout.partition_key[num - 1].name in already_filtered_on:
             filterable.add(layout.partition_key[num].name)
         else:
             break
-    for num in range(1, len(layout.clustering_key)):
-        if layout.clustering_key[num - 1].name in already_filtered_on:
+    for num in range(0, len(layout.clustering_key)):
+        if num == 0 or layout.clustering_key[num - 1].name in already_filtered_on:
             filterable.add(layout.clustering_key[num].name)
         else:
             break
-    for cd in layout.columns.values():
-        if cd.index:
-            filterable.add(cd.name)
+    for idx in layout.indexes.itervalues():
+        filterable.add(idx.index_options["target"])
     return map(maybe_escape_name, filterable)
 
 explain_completion('selector', 'colname')
@@ -830,16 +829,16 @@ def insert_newval_completer(ctxt, cass):
     if len(valuesdone) >= len(insertcols):
         return []
     curcol = insertcols[len(valuesdone)]
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'set'):
         return ['{']
     if coltype == 'list':
         return ['[']
     if coltype == 'boolean':
         return ['true', 'false']
+
     return [Hint('<value for %s (%s)>' % (maybe_escape_name(curcol),
-                                          cqltype.cql_parameterized_type()))]
+                                          coltype))]
 
 
 @completer_for('insertStatement', 'valcomma')
@@ -899,29 +898,28 @@ def update_col_completer(ctxt, cass):
 def update_countername_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    cqltype = layout.columns[curcol].data_type
-    coltype = cqltype.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype == 'counter':
         return [maybe_escape_name(curcol)]
     if coltype in ('map', 'set'):
         return ["{"]
     if coltype == 'list':
         return ["["]
-    return [Hint('<term (%s)>' % cqltype.cql_parameterized_type())]
+    return [Hint('<term (%s)>' % coltype)]
 
 
 @completer_for('assignment', 'counterop')
 def update_counterop_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    return ['+', '-'] if layout.columns[curcol].data_type.typename == 'counter' else []
+    return ['+', '-'] if layout.columns[curcol].cql_type == 'counter' else []
 
 
 @completer_for('assignment', 'inc')
 def update_counter_inc_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    if layout.columns[curcol].data_type.typename == 'counter':
+    if layout.columns[curcol].cql_type == 'counter':
         return [Hint('<wholenumber>')]
     return []
 
@@ -947,7 +945,7 @@ def update_listcol_completer(ctxt, cass):
 def update_indexbracket_completer(ctxt, cass):
     layout = get_table_meta(ctxt, cass)
     curcol = dequote_name(ctxt.get_binding('updatecol', ''))
-    coltype = layout.columns[curcol].data_type.typename
+    coltype = layout.columns[curcol].cql_type
     if coltype in ('map', 'list'):
         return ['[']
     return []
@@ -1174,8 +1172,10 @@ explain_completion('createUserTypeStatement', 'newcol', '<new_field_name>')
 
 @completer_for('createIndexStatement', 'col')
 def create_index_col_completer(ctxt, cass):
+    """ Return the columns for which an index doesn't exist yet. """
     layout = get_table_meta(ctxt, cass)
-    colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+    idx_targets = [idx.index_options["target"] for idx in layout.indexes.itervalues()]
+    colnames = [cd.name for cd in layout.columns.values() if cd.name not in idx_targets]
     return map(maybe_escape_name, colnames)
 
 syntax_rules += r'''

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_completion.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py
index 7cf583d..e5eb9e1 100644
--- a/pylib/cqlshlib/test/test_cqlsh_completion.py
+++ b/pylib/cqlshlib/test/test_cqlsh_completion.py
@@ -341,18 +341,18 @@ class TestCqlshCompletion(CqlshCompletionCase):
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs'",
                             choices=[',', 'WHERE'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonel",
-                            choices=['<quotedName>', '<identifier>'])
+                            immediate='ykey ')
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey ",
                             choices=['=', '<=', '>=', '>', '<', 'CONTAINS', 'IN', '['])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 ",
                             choices=['AND', 'IF', ';'])
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE lonelykey = 0.0 AND ",
-                            choices=['TOKEN(', '<identifier>', '<quotedName>'])
+                            choices=['TOKEN(', 'lonelykey'])
 
         self.trycompletions("UPDATE empty_table SET lonelycol = 'eggs' WHERE TOKEN(lonelykey ",
                             choices=[',', ')'])
@@ -654,7 +654,8 @@ class TestCqlshCompletion(CqlshCompletionCase):
                             choices=['base_time_seconds', 'max_sstable_age_days',
                                     'timestamp_resolution', 'min_threshold', 'class', 'max_threshold',
                                     'tombstone_compaction_interval', 'tombstone_threshold',
-                                    'enabled', 'unchecked_tombstone_compaction'])
+                                    'enabled', 'unchecked_tombstone_compaction',
+                                    'max_window_size_seconds'])
 
     def test_complete_in_create_columnfamily(self):
         self.trycompletions('CREATE C', choices=['COLUMNFAMILY', 'CUSTOM'])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1b81ad19/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 3246541..7a2fc86 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -369,21 +369,6 @@ class TestCqlshOutput(BaseTestCase):
             """),
         ), env={'TZ': 'Etc/UTC'})
 
-        self.assertQueriesGiveColoredOutput((
-            ('''select timestampcol from has_all_types where num = 0;''', """
-             timestampcol
-             MMMMMMMMMMMM
-            --------------------------
-
-             2012-05-14 07:53:20-0500
-             GGGGGGGGGGGGGGGGGGGGGGGG
-
-
-            (1 rows)
-            nnnnnnnn
-            """),
-        ), env={'TZ': 'EST'})
-
     def test_boolean_output(self):
         self.assertCqlverQueriesGiveColoredOutput((
             ('select num, booleancol from has_all_types where num in (0, 1, 2, 3);', """


[12/13] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.1

Posted by jm...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.1


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

Branch: refs/heads/trunk
Commit: 6bda8868caedc831767e7de398e9d3be53142a11
Parents: 60aeef3 803a3d9
Author: Joshua McKenzie <jm...@apache.org>
Authored: Tue Dec 1 13:56:25 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:56:25 2015 -0500

----------------------------------------------------------------------
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-3f15725.zip | Bin 234113 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  10 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 5 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------



[07/13] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by jm...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.0
Commit: 25a1e8960cdc7c7558e1ec7e34e7b8e22cfde152
Parents: 3864b21 1b81ad1
Author: Joshua McKenzie <jm...@apache.org>
Authored: Tue Dec 1 13:55:07 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:55:07 2015 -0500

----------------------------------------------------------------------

----------------------------------------------------------------------



[06/13] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by jm...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/trunk
Commit: 25a1e8960cdc7c7558e1ec7e34e7b8e22cfde152
Parents: 3864b21 1b81ad1
Author: Joshua McKenzie <jm...@apache.org>
Authored: Tue Dec 1 13:55:07 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:55:07 2015 -0500

----------------------------------------------------------------------

----------------------------------------------------------------------



[13/13] cassandra git commit: Merge branch 'cassandra-3.1' into trunk

Posted by jm...@apache.org.
Merge branch 'cassandra-3.1' into trunk


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

Branch: refs/heads/trunk
Commit: 5daf8d020f7a37a8e71e3441c8cedc0cdaa85b04
Parents: 7c3e0b1 6bda886
Author: Joshua McKenzie <jm...@apache.org>
Authored: Tue Dec 1 13:57:04 2015 -0500
Committer: Joshua McKenzie <jm...@apache.org>
Committed: Tue Dec 1 13:57:04 2015 -0500

----------------------------------------------------------------------
 ...andra-driver-internal-only-3.0.0-6af642d.zip | Bin 0 -> 228893 bytes
 ...iver-internal-only-3.0.0a3.post0-3f15725.zip | Bin 234113 -> 0 bytes
 pylib/cqlshlib/cql3handling.py                  |  36 +++++++++----------
 pylib/cqlshlib/test/test_cqlsh_completion.py    |  10 +++---
 pylib/cqlshlib/test/test_cqlsh_output.py        |  15 --------
 5 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5daf8d02/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------