Author: jbellis
Date: Thu Mar 31 18:39:37 2011
New Revision: 1087404
URL: http://svn.apache.org/viewvc?rev=1087404&view=rev
Log:
add negative number support to cli, trunk version
patch by Pavel Yaskevich for CASSANDRA-2358
Modified:
cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g
cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g?rev=1087404&r1=1087403&r2=1087404&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g Thu Mar 31 18:39:37
2011
@@ -423,6 +423,7 @@ attrValueString
attrValueInt
: IntegerPositiveLiteral
+ | IntegerNegativeLiteral
;
attrValueDouble
@@ -471,11 +472,11 @@ columnFamily
;
rowKey
- : (Identifier | StringLiteral | IntegerPositiveLiteral | functionCall)
+ : (Identifier | StringLiteral | IntegerPositiveLiteral |
IntegerNegativeLiteral | functionCall)
;
value
- : (Identifier | IntegerPositiveLiteral | StringLiteral | functionCall)
+ : (Identifier | IntegerPositiveLiteral | IntegerNegativeLiteral |
StringLiteral | functionCall)
;
functionCall
@@ -484,7 +485,7 @@ functionCall
;
functionArgument
- : Identifier | StringLiteral | IntegerPositiveLiteral
+ : Identifier | StringLiteral | IntegerPositiveLiteral |
IntegerNegativeLiteral
;
startKey
@@ -496,7 +497,7 @@ endKey
;
columnOrSuperColumn
- : (Identifier | IntegerPositiveLiteral | StringLiteral | functionCall)
+ : (Identifier | IntegerPositiveLiteral | IntegerNegativeLiteral |
StringLiteral | functionCall)
;
host
@@ -519,8 +520,8 @@ port
;
incrementValue
- : IntegerNegativeLiteral
- | IntegerPositiveLiteral
+ : IntegerPositiveLiteral
+ | IntegerNegativeLiteral
;
//
Modified: cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java?rev=1087404&r1=1087403&r2=1087404&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Thu Mar 31
18:39:37 2011
@@ -40,7 +40,11 @@ public class CliTest extends CleanupHelp
"create column family CF1 with comparator=UTF8Type and
column_metadata=[{ column_name:world, validation_class:IntegerType,
index_type:0, index_name:IdxName }, { column_name:world2,
validation_class:LongType, index_type:KEYS, index_name:LongIdxName}];",
"assume CF1 keys as utf8;",
"set CF1[hello][world] = 123848374878933948398384;",
+ "set CF1[hello][-31337] = 'some string value';",
+ "get CF1[hello][-31337];",
"get CF1[hello][world];",
+ "set CF1[hello][-31337] = -23876;",
+ "set CF1[hello][-31337] = long(-23876);",
"set CF1[hello][world2] = 15;",
"get CF1 where world2 = long(15);",
"get cF1 where world2 = long(15);",
@@ -79,6 +83,10 @@ public class CliTest extends CleanupHelp
"get SCF1['hello'][1][9999] as Long;",
"get SCF1['hello'][1][9999] as Bytes;",
"set SCF1['hello'][1][9999] = Long(1234);",
+ "set SCF1['hello'][-1][-12] = Long(5678);",
+ "get SCF1['hello'][-1][-12];",
+ "set SCF1['hello'][-1][-12] = -340897;",
+ "set SCF1['hello'][-1][-12] = integer(-340897);",
"get SCF1['hello'][1][9999];",
"get SCF1['hello'][1][9999] as Long;",
"del SCF1['hello'][1][9999];",