From 17186d82549e82daf032c132c9520aa795680a4f Mon Sep 17 00:00:00 2001 From: Aleksey Yeschenko Date: Sat, 24 Aug 2013 03:21:52 +0300 Subject: [PATCH] Correct minor CQL3 grammar rules (USING) --- pylib/cqlshlib/cql3handling.py | 2 +- src/java/org/apache/cassandra/cql3/Cql.g | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index 82e14d4594..c5b449f84d 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -955,7 +955,7 @@ def update_indexbracket_completer(ctxt, cass): syntax_rules += r''' ::= "DELETE" ( ( "," )* )? "FROM" cf= - ( "USING" [delopt]= ( "AND" [delopt]= )* )? + ( "USING" [delopt]= )? "WHERE" ; ::= delcol= ( memberbracket="[" memberselector= "]" )? diff --git a/src/java/org/apache/cassandra/cql3/Cql.g b/src/java/org/apache/cassandra/cql3/Cql.g index 218c541e53..f59be51091 100644 --- a/src/java/org/apache/cassandra/cql3/Cql.g +++ b/src/java/org/apache/cassandra/cql3/Cql.g @@ -290,19 +290,11 @@ insertStatement returns [UpdateStatement expr] ; usingClause[Attributes attrs] - : K_USING usingClauseObjective[attrs] ( K_AND? usingClauseObjective[attrs] )* - ; - -usingClauseDelete[Attributes attrs] - : K_USING usingClauseDeleteObjective[attrs] ( K_AND? usingClauseDeleteObjective[attrs] )* - ; - -usingClauseDeleteObjective[Attributes attrs] - : K_TIMESTAMP ts=INTEGER { attrs.timestamp = Long.valueOf($ts.text); } + : K_USING usingClauseObjective[attrs] ( K_AND usingClauseObjective[attrs] )* ; usingClauseObjective[Attributes attrs] - : usingClauseDeleteObjective[attrs] + : K_TIMESTAMP ts=INTEGER { attrs.timestamp = Long.valueOf($ts.text); } | K_TTL t=INTEGER { attrs.timeToLive = Integer.valueOf($t.text); } ; @@ -357,6 +349,10 @@ deleteOp returns [Operation.RawDeletion op] | c=cident '[' t=term ']' { $op = new Operation.ElementDeletion(c, t); } ; +usingClauseDelete[Attributes attrs] + : K_USING K_TIMESTAMP ts=INTEGER { attrs.timestamp = Long.valueOf($ts.text); } + ; + /** * BEGIN BATCH * UPDATE SET name1 = value1 WHERE KEY = keyname1;