cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: cqlsh: fix CREATE/ALTER WITH completion
Date Mon, 21 Oct 2013 19:15:07 GMT
Updated Branches:
  refs/heads/cassandra-2.0 0c5f05bd9 -> c4c8bca8d


cqlsh: fix CREATE/ALTER WITH completion

patch by Mikhail Stepura; reviewed by Aleksey Yeschenko for
CASSANDRA-6196


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

Branch: refs/heads/cassandra-2.0
Commit: c4c8bca8d55142d64762fc8f2557eed80c1ceaf8
Parents: 0c5f05b
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Tue Oct 22 03:14:24 2013 +0800
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Tue Oct 22 03:14:24 2013 +0800

----------------------------------------------------------------------
 CHANGES.txt                    |  1 +
 pylib/cqlshlib/cql3handling.py | 68 +------------------------------------
 2 files changed, 2 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4c8bca8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 895ffcc..40d752c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -26,6 +26,7 @@
  * CQL3: support pre-epoch longs for TimestampType (CASSANDRA-6212)
  * Add reloadtriggers command to nodetool (CASSANDRA-4949)
  * cqlsh: ignore empty 'value alias' in DESCRIBE (CASSANDRA-6139)
+ * cqlsh: fix CREATE/ALTER WITH completion (CASSANDRA-6196)
 Merged from 1.2:
  * (Hadoop) Require CFRR batchSize to be at least 2 (CASSANDRA-6114)
  * Add a warning for small LCS sstable size (CASSANDRA-6191)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4c8bca8/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 8ec3573..bc349a7 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -830,72 +830,6 @@ def create_ks_wat_completer(ctxt, cass):
         return ['KEYSPACE']
     return ['KEYSPACE', 'SCHEMA']
 
-@completer_for('property', 'propname')
-def keyspace_properties_option_name_completer(ctxt, cass):
-    optsseen = ctxt.get_binding('propname', ())
-    if 'replication' not in optsseen:
-        return ['replication']
-    return ["durable_writes"]
-
-@completer_for('propertyValue', 'propsimpleval')
-def property_value_completer(ctxt, cass):
-    optname = ctxt.get_binding('propname')[-1]
-    if optname == 'durable_writes':
-        return ["'true'", "'false'"]
-    if optname == 'replication':
-        return ["{'class': '"]
-    return ()
-
-@completer_for('propertyValue', 'propmapkey')
-def keyspace_properties_map_key_completer(ctxt, cass):
-    optname = ctxt.get_binding('propname')[-1]
-    if optname != 'replication':
-        return ()
-    keysseen = map(dequote_value, ctxt.get_binding('propmapkey', ()))
-    valsseen = map(dequote_value, ctxt.get_binding('propmapval', ()))
-    for k, v in zip(keysseen, valsseen):
-        if k == 'class':
-            repclass = v
-            break
-    else:
-        return ["'class'"]
-    if repclass in CqlRuleSet.replication_factor_strategies:
-        opts = set(('replication_factor',))
-    elif repclass == 'NetworkTopologyStrategy':
-        return [Hint('<dc_name>')]
-    return map(escape_value, opts.difference(keysseen))
-
-@completer_for('propertyValue', 'propmapval')
-def keyspace_properties_map_value_completer(ctxt, cass):
-    optname = ctxt.get_binding('propname')[-1]
-    if optname != 'replication':
-        return ()
-    currentkey = dequote_value(ctxt.get_binding('propmapkey')[-1])
-    if currentkey == 'class':
-        return map(escape_value, CqlRuleSet.replication_strategies)
-    return [Hint('<value>')]
-
-@completer_for('propertyValue', 'ender')
-def keyspace_properties_map_ender_completer(ctxt, cass):
-    optname = ctxt.get_binding('propname')[-1]
-    if optname != 'replication':
-        return [',']
-    keysseen = map(dequote_value, ctxt.get_binding('propmapkey', ()))
-    valsseen = map(dequote_value, ctxt.get_binding('propmapval', ()))
-    for k, v in zip(keysseen, valsseen):
-        if k == 'class':
-            repclass = v
-            break
-    else:
-        return [',']
-    if repclass in CqlRuleSet.replication_factor_strategies:
-        opts = set(('replication_factor',))
-        if 'replication_factor' not in keysseen:
-            return [',']
-    if repclass == 'NetworkTopologyStrategy' and len(keysseen) == 1:
-        return [',']
-    return ['}']
-
 syntax_rules += r'''
 <createColumnFamilyStatement> ::= "CREATE" wat=( "COLUMNFAMILY" | "TABLE" ) ("IF" "NOT"
"EXISTS")?
                                     ( ks=<nonSystemKeyspaceName> dot="." )? cf=<cfOrKsName>
@@ -1021,7 +955,7 @@ def drop_index_completer(ctxt, cass):
     return map(maybe_escape_name, cass.get_index_names())
 
 syntax_rules += r'''
-<alterTableStatement> ::= "ALTER" ( "COLUMNFAMILY" | "TABLE" ) cf=<columnFamilyName>
+<alterTableStatement> ::= "ALTER" wat=( "COLUMNFAMILY" | "TABLE" ) cf=<columnFamilyName>
                                <alterInstructions>
                         ;
 <alterInstructions> ::= "ALTER" existcol=<cident> "TYPE" <storageType>


Mime
View raw message