You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/08/25 16:57:28 UTC

[1/2] cassandra git commit: cqlsh: use python driver for CQL keyword list

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 d526536f2 -> 134bcda0c


cqlsh: use python driver for CQL keyword list

Patch by Stefania Alborghetti; reviewed by Tyler Hobbs for
CASSANDRA-9232


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

Branch: refs/heads/cassandra-2.2
Commit: 386f197da3aa0804338c24811d354bdebe1c1222
Parents: 7d74563
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Tue Aug 25 09:54:16 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Aug 25 09:54:16 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                    |  1 +
 pylib/cqlshlib/cql3handling.py | 39 ++++++++++---------------------------
 pylib/cqlshlib/cqlhandling.py  | 12 ++----------
 3 files changed, 13 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/386f197d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dcae493..92dcf59 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.9
+ * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
  * Avoid race condition during read repair (CASSANDRA-9460)
  * (cqlsh) default load-from-file encoding to utf-8 (CASSANDRA-9898)
  * Avoid returning Permission.NONE when failing to query users table (CASSANDRA-10168)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/386f197d/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 92e3f12..2857a7e 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -37,19 +37,6 @@ SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth')
 NONALTERBALE_KEYSPACES = ('system')
 
 class Cql3ParsingRuleSet(CqlParsingRuleSet):
-    keywords = set((
-        'select', 'from', 'where', 'and', 'key', 'insert', 'update', 'with',
-        'limit', 'using', 'use', 'count', 'set',
-        'begin', 'apply', 'batch', 'truncate', 'delete', 'in', 'create',
-        'keyspace', 'schema', 'columnfamily', 'table', 'index', 'on', 'drop',
-        'primary', 'into', 'values', 'timestamp', 'ttl', 'alter', 'add', 'type',
-        'compact', 'storage', 'order', 'by', 'asc', 'desc', 'clustering',
-        'token', 'writetime', 'map', 'list', 'to', 'custom', 'if', 'not'
-    ))
-
-    unreserved_keywords = set((
-        'key', 'clustering', 'ttl', 'compact', 'storage', 'type', 'values', 'custom', 'exists'
-    ))
 
     columnfamily_layout_options = (
         ('bloom_filter_fp_chance', None),
@@ -89,10 +76,6 @@ class Cql3ParsingRuleSet(CqlParsingRuleSet):
         'SERIAL'
     )
 
-    maybe_escape_name = staticmethod(maybe_escape_name)
-
-    escape_name = staticmethod(escape_name)
-
     @classmethod
     def escape_value(cls, value):
         if value is None:
@@ -132,8 +115,6 @@ explain_completion = CqlRuleSet.explain_completion
 dequote_value = CqlRuleSet.dequote_value
 dequote_name = CqlRuleSet.dequote_name
 escape_value = CqlRuleSet.escape_value
-maybe_escape_name = CqlRuleSet.maybe_escape_name
-
 
 # BEGIN SYNTAX/COMPLETION RULE DEFINITIONS
 
@@ -251,7 +232,7 @@ JUNK ::= /([ \t\r\f\v]+|(--|[/][/])[^\n\r]*([\n\r]|$)|[/][*].*?[*][/])/ ;
                            ;
 
 # timestamp is included here, since it's also a keyword
-<simpleStorageType> ::= typename=( <identifier> | <stringLiteral> | <K_TIMESTAMP> ) ;
+<simpleStorageType> ::= typename=( <identifier> | <stringLiteral> | "timestamp" ) ;
 
 <userType> ::= utname=<cfOrKsName> ;
 
@@ -284,14 +265,14 @@ JUNK ::= /([ \t\r\f\v]+|(--|[/][/])[^\n\r]*([\n\r]|$)|[/][*].*?[*][/])/ ;
                | <unreservedKeyword>;
 
 <unreservedKeyword> ::= nocomplete=
-                        ( <K_KEY>
-                        | <K_CLUSTERING>
-                        # | <K_COUNT>  -- to get count(*) completion, treat count as reserved
-                        | <K_TTL>
-                        | <K_COMPACT>
-                        | <K_STORAGE>
-                        | <K_TYPE>
-                        | <K_VALUES> )
+                        ( "key"
+                        | "clustering"
+                        # | "count" -- to get count(*) completion, treat count as reserved
+                        | "ttl"
+                        | "compact"
+                        | "storage"
+                        | "type"
+                        | "values" )
                       ;
 
 <property> ::= [propname]=<cident> propeq="=" [propval]=<propertyValue>
@@ -1172,7 +1153,7 @@ def username_name_completer(ctxt, cass):
         return "'%s'" % name
 
     # disable completion for CREATE USER.
-    if ctxt.matched[0][0] == 'K_CREATE':
+    if ctxt.matched[0][0] == 'create':
         return [Hint('<username>')]
 
     session = cass.session

http://git-wip-us.apache.org/repos/asf/cassandra/blob/386f197d/pylib/cqlshlib/cqlhandling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cqlhandling.py b/pylib/cqlshlib/cqlhandling.py
index 1836961..4009125 100644
--- a/pylib/cqlshlib/cqlhandling.py
+++ b/pylib/cqlshlib/cqlhandling.py
@@ -24,7 +24,6 @@ Hint = pylexotron.Hint
 
 
 class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
-    keywords = set()
 
     available_compression_classes = (
         'DeflateCompressor',
@@ -56,7 +55,6 @@ class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
 
         # note: commands_end_with_newline may be extended by callers.
         self.commands_end_with_newline = set()
-        self.set_keywords_as_syntax()
 
     def completer_for(self, rulename, symname):
         def registrator(f):
@@ -80,12 +78,6 @@ class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
 
         return explainer
 
-    def set_keywords_as_syntax(self):
-        syntax = []
-        for k in self.keywords:
-            syntax.append('<K_%s> ::= "%s" ;' % (k.upper(), k))
-        self.append_rules('\n'.join(syntax))
-
     def cql_massage_tokens(self, toklist):
         curstmt = []
         output = []
@@ -146,9 +138,9 @@ class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
             else:
                 output.append(stmt)
             if len(stmt) > 2:
-                if stmt[-3][0] == 'K_APPLY':
+                if stmt[-3][0] == 'apply':
                     in_batch = False
-                elif stmt[0][0] == 'K_BEGIN':
+                elif stmt[0][0] == 'begin':
                     in_batch = True
         return output, in_batch
 


[2/2] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by ty...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2

Conflicts:
	CHANGES.txt
	pylib/cqlshlib/cql3handling.py


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

Branch: refs/heads/cassandra-2.2
Commit: 134bcda0cd780a298c087733b44edbbbbd7315bf
Parents: d526536 386f197
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Tue Aug 25 09:57:18 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Aug 25 09:57:18 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                    |  3 ++-
 pylib/cqlshlib/cql3handling.py | 38 ++++++++++---------------------------
 pylib/cqlshlib/cqlhandling.py  | 12 ++----------
 3 files changed, 14 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/134bcda0/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 3065d0b,92dcf59..97d8b8b
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,17 -1,5 +1,18 @@@
 -2.1.9
 +2.2.1
-  * add CLEAR cqlsh command (CASSANDRA-10086)
++ * (cqlsh) add CLEAR command (CASSANDRA-10086)
 + * Support string literals as Role names for compatibility (CASSANDRA-10135)
 + * Allow count(*) and count(1) to be use as normal aggregation (CASSANDRA-10114)
 + * An NPE is thrown if the column name is unknown for an IN relation (CASSANDRA-10043)
 + * Apply commit_failure_policy to more errors on startup (CASSANDRA-9749)
 + * Fix histogram overflow exception (CASSANDRA-9973)
 + * Route gossip messages over dedicated socket (CASSANDRA-9237)
 + * Add checksum to saved cache files (CASSANDRA-9265)
 + * Log warning when using an aggregate without partition key (CASSANDRA-9737)
 + * Avoid grouping sstables for anticompaction with DTCS (CASSANDRA-9900)
 + * UDF / UDA execution time in trace (CASSANDRA-9723)
 + * Fix broken internode SSL (CASSANDRA-9884)
 +Merged from 2.1:
+  * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
   * Avoid race condition during read repair (CASSANDRA-9460)
   * (cqlsh) default load-from-file encoding to utf-8 (CASSANDRA-9898)
   * Avoid returning Permission.NONE when failing to query users table (CASSANDRA-10168)

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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/134bcda0/pylib/cqlshlib/cqlhandling.py
----------------------------------------------------------------------