You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2014/09/25 03:33:51 UTC
[5/5] git commit: Remove cassandra-cli
Remove cassandra-cli
patch by Aleksey Yeschenko; reviewed by Brandon Williams and Jason Brown
for CASSANDRA-7920
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/38027382
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/38027382
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/38027382
Branch: refs/heads/trunk
Commit: 380273826d05913d4b80b73e0db2ea49711b17c7
Parents: 24b18a9
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Sep 24 18:00:43 2014 -0700
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 24 18:33:29 2014 -0700
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 3 +-
bin/cassandra-cli | 51 -
bin/cassandra-cli.bat | 36 -
build.xml | 28 +-
debian/cassandra.install | 1 -
examples/hadoop_cql3_word_count/README.txt | 2 +-
examples/hadoop_word_count/README.txt | 7 +-
lib/jline-1.0.jar | Bin 91183 -> 0 bytes
lib/licenses/jline-1.0.txt | 33 -
src/java/org/apache/cassandra/cli/Cli.g | 728 ----
.../org/apache/cassandra/cli/CliClient.java | 3230 ------------------
.../apache/cassandra/cli/CliCommandHelp.java | 24 -
.../org/apache/cassandra/cli/CliCompiler.java | 172 -
.../org/apache/cassandra/cli/CliCompleter.java | 85 -
src/java/org/apache/cassandra/cli/CliMain.java | 405 ---
.../org/apache/cassandra/cli/CliOptions.java | 319 --
.../apache/cassandra/cli/CliSessionState.java | 94 -
.../org/apache/cassandra/cli/CliUserHelp.java | 29 -
src/java/org/apache/cassandra/cli/CliUtils.java | 128 -
.../cli/transport/FramedTransportFactory.java | 32 -
.../cli/transport/SSLTransportFactory.java | 47 -
.../org/apache/cassandra/db/DefsTables.java | 62 -
.../cassandra/thrift/SSLTransportFactory.java | 7 +-
.../org/apache/cassandra/cli/CliHelp.yaml | 1262 -------
.../cassandra/pig/CqlRecordReaderTest.java | 20 +-
.../cassandra/pig/CqlTableDataTypeTest.java | 29 +-
.../org/apache/cassandra/pig/CqlTableTest.java | 44 +-
.../org/apache/cassandra/pig/PigTestBase.java | 74 +-
.../pig/ThriftColumnFamilyDataTypeTest.java | 259 +-
.../cassandra/pig/ThriftColumnFamilyTest.java | 467 ++-
test/unit/org/apache/cassandra/cli/CliTest.java | 341 --
32 files changed, 362 insertions(+), 7658 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cf8f263..30a87a5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0
+ * Remove cassandra-cli (CASSANDRA-7920)
* Optimize java source-based UDF invocation (CASSANDRA-7924)
* Accept dollar quoted strings in CQL (CASSANDRA-7769)
* Make assassinate a first class command (CASSANDRA-7935)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 0f47a69..96f2c05 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -21,10 +21,11 @@ New features
- SSTable file name is changed. Now you don't have Keyspace/CF name
in file name. Also, secondary index has its own directory under parent's
directory.
-
+
Upgrading
---------
+ - cassandra-cli has been removed. Please use cqlsh instead.
- YamlFileNetworkTopologySnitch has been removed; switch to
GossipingPropertyFileSnitch instead.
- CQL2 has been removed entirely in this release (previously deprecated
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/bin/cassandra-cli
----------------------------------------------------------------------
diff --git a/bin/cassandra-cli b/bin/cassandra-cli
deleted file mode 100755
index a2696da..0000000
--- a/bin/cassandra-cli
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
- for include in "`dirname "$0"`/cassandra.in.sh" \
- "$HOME/.cassandra.in.sh" \
- /usr/share/cassandra/cassandra.in.sh \
- /usr/local/share/cassandra/cassandra.in.sh \
- /opt/cassandra/cassandra.in.sh; do
- if [ -r "$include" ]; then
- . "$include"
- break
- fi
- done
-elif [ -r "$CASSANDRA_INCLUDE" ]; then
- . "$CASSANDRA_INCLUDE"
-fi
-
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
- JAVA="$JAVA_HOME/bin/java"
-else
- JAVA="`which java`"
-fi
-
-if [ -z "$CLASSPATH" ]; then
- echo "You must set the CLASSPATH var" >&2
- exit 1
-fi
-
-"$JAVA" -ea -cp "$CLASSPATH" -Xmx256M \
- -Dcassandra.storagedir="$cassandra_storagedir" \
- -Dlogback.configurationFile=logback-tools.xml \
- org.apache.cassandra.cli.CliMain "$@"
-
-# vi:ai sw=4 ts=4 tw=0 et
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/bin/cassandra-cli.bat
----------------------------------------------------------------------
diff --git a/bin/cassandra-cli.bat b/bin/cassandra-cli.bat
deleted file mode 100644
index 6211371..0000000
--- a/bin/cassandra-cli.bat
+++ /dev/null
@@ -1,36 +0,0 @@
-@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one or more
-@REM contributor license agreements. See the NOTICE file distributed with
-@REM this work for additional information regarding copyright ownership.
-@REM The ASF licenses this file to You under the Apache License, Version 2.0
-@REM (the "License"); you may not use this file except in compliance with
-@REM the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing, software
-@REM distributed under the License is distributed on an "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@REM See the License for the specific language governing permissions and
-@REM limitations under the License.
-
-@echo off
-if "%OS%" == "Windows_NT" setlocal
-
-pushd "%~dp0"
-call cassandra.in.bat
-
-if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
-if NOT DEFINED JAVA_HOME goto :err
-
-echo Starting Cassandra Client
-"%JAVA_HOME%\bin\java" -cp %CASSANDRA_CLASSPATH% org.apache.cassandra.cli.CliMain %*
-goto finally
-
-:err
-echo The JAVA_HOME environment variable must be set to run this program!
-pause
-
-:finally
-
-ENDLOCAL
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 8016a8b..e05b5c9 100644
--- a/build.xml
+++ b/build.xml
@@ -190,28 +190,6 @@
</target>
<!--
- This generates the CLI grammar files from Cli.g
- -->
- <target name="check-gen-cli-grammar">
- <uptodate property="cliUpToDate"
- srcfile="${build.src.java}/org/apache/cassandra/cli/Cli.g"
- targetfile="${build.src.gen-java}/org/apache/cassandra/cli/Cli.tokens"/>
- </target>
-
- <target name="gen-cli-grammar" depends="check-gen-cli-grammar" unless="cliUpToDate">
- <echo>Building Grammar ${build.src.java}/org/apache/cassandra/cli/Cli.g ....</echo>
- <java classname="org.antlr.Tool"
- classpath="${build.dir.lib}/jars/antlr-3.5.2.jar;${build.lib}/antlr-runtime-3.5.2.jar;${build.lib}/stringtemplate-4.0.2.jar"
- fork="true"
- failonerror="true">
- <jvmarg value="-Xmx512M" />
- <arg value="${build.src.java}/org/apache/cassandra/cli/Cli.g" />
- <arg value="-fo" />
- <arg value="${build.src.gen-java}/org/apache/cassandra/cli/" />
- </java>
- </target>
-
- <!--
This generates the CQL grammar files from Cql.g
-->
<target name="check-gen-cql3-grammar">
@@ -351,9 +329,6 @@
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.2"/>
<dependency groupId="org.codehaus.jackson" artifactId="jackson-core-asl" version="1.9.2"/>
<dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl" version="1.9.2"/>
- <dependency groupId="jline" artifactId="jline" version="1.0">
- <exclusion groupId="junit" artifactId="junit"/>
- </dependency>
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
<dependency groupId="com.github.jbellis" artifactId="jamm" version="0.2.6"/>
@@ -486,7 +461,6 @@
<dependency groupId="org.slf4j" artifactId="slf4j-api"/>
<dependency groupId="org.codehaus.jackson" artifactId="jackson-core-asl"/>
<dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl"/>
- <dependency groupId="jline" artifactId="jline"/>
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple"/>
<dependency groupId="com.boundary" artifactId="high-scale-lib"/>
<dependency groupId="org.yaml" artifactId="snakeyaml"/>
@@ -706,7 +680,7 @@
depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
<target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
- <target depends="init,gen-cli-grammar,gen-cql3-grammar"
+ <target depends="init,gen-cql3-grammar"
name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<!-- Order matters! -->
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/debian/cassandra.install
----------------------------------------------------------------------
diff --git a/debian/cassandra.install b/debian/cassandra.install
index a4654d1..2fbbac1 100644
--- a/debian/cassandra.install
+++ b/debian/cassandra.install
@@ -11,7 +11,6 @@ debian/cassandra.in.sh usr/share/cassandra
debian/cassandra.conf etc/security/limits.d
debian/cassandra-sysctl.conf etc/sysctl.d
bin/cassandra usr/sbin
-bin/cassandra-cli usr/bin
bin/nodetool usr/bin
bin/sstablekeys usr/bin
bin/sstableloader usr/bin
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/examples/hadoop_cql3_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_cql3_word_count/README.txt b/examples/hadoop_cql3_word_count/README.txt
index e01632b..b69bdd5 100644
--- a/examples/hadoop_cql3_word_count/README.txt
+++ b/examples/hadoop_cql3_word_count/README.txt
@@ -19,7 +19,7 @@ contrib/word_count$ bin/word_count_setup
contrib/word_count$ bin/word_count
contrib/word_count$ bin/word_count_counters
-In order to view the results in Cassandra, one can use bin/cassandra-cli and
+In order to view the results in Cassandra, one can use bin/cqlsh and
perform the following operations:
$ bin/cqlsh localhost
> use cql3_worldcount;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index 9a93908..ec6f512 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -19,12 +19,11 @@ contrib/word_count$ bin/word_count_setup
contrib/word_count$ bin/word_count
contrib/word_count$ bin/word_count_counters
-In order to view the results in Cassandra, one can use bin/cassandra-cli and
+In order to view the results in Cassandra, one can use bin/cqlsh and
perform the following operations:
-$ bin/cassandra-cli
-> connect localhost/9160;
+$ bin/cqlsh localhost
> use wordcount;
-> list output_words;
+> select * from output_words;
The output of the word count can now be configured. In the bin/word_count
file, you can specify the OUTPUT_REDUCER. The two options are 'filesystem'
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/lib/jline-1.0.jar
----------------------------------------------------------------------
diff --git a/lib/jline-1.0.jar b/lib/jline-1.0.jar
deleted file mode 100644
index 6c949b2..0000000
Binary files a/lib/jline-1.0.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/lib/licenses/jline-1.0.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/jline-1.0.txt b/lib/licenses/jline-1.0.txt
deleted file mode 100644
index 1cdc44c..0000000
--- a/lib/licenses/jline-1.0.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Copyright (c) 2002-2006, Marc Prud'hommeaux <mw...@cornell.edu>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:
-
-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with
-the distribution.
-
-Neither the name of JLine nor the names of its contributors
-may be used to endorse or promote products derived from this
-software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
http://git-wip-us.apache.org/repos/asf/cassandra/blob/38027382/src/java/org/apache/cassandra/cli/Cli.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/Cli.g b/src/java/org/apache/cassandra/cli/Cli.g
deleted file mode 100644
index 07cdc1f..0000000
--- a/src/java/org/apache/cassandra/cli/Cli.g
+++ /dev/null
@@ -1,728 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// ANTLR Grammar for the Cassandra Command Line Interface (CLI).
-
-grammar Cli;
-
-options {
- output=AST;
- ASTLabelType=CommonTree;
- backtrack=true;
-}
-
-//
-// Nodes in the AST
-//
-tokens {
- //
- // Top-level nodes. These typically correspond to
- // various top-level CLI statements.
- //
- NODE_CONNECT;
- NODE_DESCRIBE;
- NODE_DESCRIBE_CLUSTER;
- NODE_USE_TABLE;
- NODE_TRACE_NEXT_QUERY;
- NODE_SET_TRACE_PROBABILITY;
- NODE_EXIT;
- NODE_HELP;
- NODE_NO_OP;
- NODE_SHOW_CLUSTER_NAME;
- NODE_SHOW_VERSION;
- NODE_SHOW_KEYSPACES;
- NODE_SHOW_SCHEMA;
- NODE_THRIFT_GET;
- NODE_THRIFT_GET_WITH_CONDITIONS;
- NODE_THRIFT_SET;
- NODE_THRIFT_COUNT;
- NODE_THRIFT_DEL;
- NODE_THRIFT_INCR;
- NODE_THRIFT_DECR;
- NODE_ADD_COLUMN_FAMILY;
- NODE_ADD_KEYSPACE;
- NODE_DEL_KEYSPACE;
- NODE_DEL_COLUMN_FAMILY;
- NODE_UPDATE_KEYSPACE;
- NODE_UPDATE_COLUMN_FAMILY;
- NODE_LIST;
- NODE_TRUNCATE;
- NODE_ASSUME;
- NODE_CONSISTENCY_LEVEL;
- NODE_DROP_INDEX;
-
- // Internal Nodes.
- NODE_COLUMN_ACCESS;
- NODE_ID_LIST;
- NODE_NEW_CF_ACCESS;
- NODE_NEW_KEYSPACE_ACCESS;
-
- CONVERT_TO_TYPE;
- FUNCTION_CALL;
- CONDITION;
- CONDITIONS;
- ARRAY;
- HASH;
- PAIR;
-
- NODE_LIMIT;
- NODE_COLUMNS;
- NODE_REVERSED;
- NODE_KEY_RANGE;
-}
-
-@parser::header {
-package org.apache.cassandra.cli;
-}
-
-@lexer::header {
-package org.apache.cassandra.cli;
-}
-
-@lexer::members
-{
- public void reportError(RecognitionException e)
- {
- StringBuilder errorMessage = new StringBuilder("Syntax error at position ").append(e.charPositionInLine).append(": ");
-
- if (e instanceof NoViableAltException)
- {
- int index = e.charPositionInLine;
- String error = this.input.substring(index, index);
- String statement = this.input.substring(0, this.input.size() - 1);
-
- errorMessage.append("unexpected \"").append(error).append("\" for `").append(statement).append("`.");
- }
- else
- {
- errorMessage.append(this.getErrorMessage(e, this.getTokenNames()));
- }
-
- throw new RuntimeException(errorMessage.toString());
- }
-}
-
-@parser::members
-{
- public void reportError(RecognitionException e)
- {
- String errorMessage = "Syntax error at position " + e.charPositionInLine + ": " + this.getErrorMessage(e, this.getTokenNames());
-
- throw new RuntimeException(errorMessage);
- }
-}
-
-//
-// Parser Section
-//
-
-// the root node
-root: statement SEMICOLON? EOF -> statement;
-
-statement
- : connectStatement
- | exitStatement
- | countStatement
- | describeTable
- | describeCluster
- | addKeyspace
- | addColumnFamily
- | updateKeyspace
- | updateColumnFamily
- | delColumnFamily
- | delKeyspace
- | useKeyspace
- | traceNextQuery
- | setTraceProbability
- | delStatement
- | getStatement
- | helpStatement
- | setStatement
- | incrStatement
- | showStatement
- | listStatement
- | truncateStatement
- | assumeStatement
- | consistencyLevelStatement
- | dropIndex
- | -> ^(NODE_NO_OP)
- ;
-
-connectStatement
- : CONNECT host '/' port (username password)?
- -> ^(NODE_CONNECT host port (username password)?)
- | CONNECT ip_address '/' port (username password)?
- -> ^(NODE_CONNECT ip_address port (username password)?)
- ;
-
-helpStatement
- : HELP HELP
- -> ^(NODE_HELP NODE_HELP)
- | HELP CONNECT
- -> ^(NODE_HELP NODE_CONNECT)
- | HELP USE
- -> ^(NODE_HELP NODE_USE_TABLE)
- | HELP TRACE NEXT QUERY
- -> ^(NODE_HELP NODE_TRACE_NEXT_QUERY)
- | HELP SET TRACE PROBABILITY
- -> ^(NODE_HELP NODE_SET_TRACE_PROBABILITY)
- | HELP DESCRIBE
- -> ^(NODE_HELP NODE_DESCRIBE)
- | HELP DESCRIBE 'CLUSTER'
- -> ^(NODE_HELP NODE_DESCRIBE_CLUSTER)
- | HELP EXIT
- -> ^(NODE_HELP NODE_EXIT)
- | HELP QUIT
- -> ^(NODE_HELP NODE_EXIT)
- | HELP SHOW 'CLUSTER NAME'
- -> ^(NODE_HELP NODE_SHOW_CLUSTER_NAME)
- | HELP SHOW KEYSPACES
- -> ^(NODE_HELP NODE_SHOW_KEYSPACES)
- | HELP SHOW SCHEMA
- -> ^(NODE_HELP NODE_SHOW_SCHEMA)
- | HELP SHOW API_VERSION
- -> ^(NODE_HELP NODE_SHOW_VERSION)
- | HELP CREATE KEYSPACE
- -> ^(NODE_HELP NODE_ADD_KEYSPACE)
- | HELP UPDATE KEYSPACE
- -> ^(NODE_HELP NODE_UPDATE_KEYSPACE)
- | HELP CREATE COLUMN FAMILY
- -> ^(NODE_HELP NODE_ADD_COLUMN_FAMILY)
- | HELP UPDATE COLUMN FAMILY
- -> ^(NODE_HELP NODE_UPDATE_COLUMN_FAMILY)
- | HELP DROP KEYSPACE
- -> ^(NODE_HELP NODE_DEL_KEYSPACE)
- | HELP DROP COLUMN FAMILY
- -> ^(NODE_HELP NODE_DEL_COLUMN_FAMILY)
- | HELP DROP INDEX
- -> ^(NODE_HELP NODE_DROP_INDEX)
- | HELP GET
- -> ^(NODE_HELP NODE_THRIFT_GET)
- | HELP SET
- -> ^(NODE_HELP NODE_THRIFT_SET)
- | HELP INCR
- -> ^(NODE_HELP NODE_THRIFT_INCR)
- | HELP DECR
- -> ^(NODE_HELP NODE_THRIFT_DECR)
- | HELP DEL
- -> ^(NODE_HELP NODE_THRIFT_DEL)
- | HELP COUNT
- -> ^(NODE_HELP NODE_THRIFT_COUNT)
- | HELP LIST
- -> ^(NODE_HELP NODE_LIST)
- | HELP TRUNCATE
- -> ^(NODE_HELP NODE_TRUNCATE)
- | HELP ASSUME
- -> ^(NODE_HELP NODE_ASSUME)
- | HELP CONSISTENCYLEVEL
- -> ^(NODE_HELP NODE_CONSISTENCY_LEVEL)
- | HELP
- -> ^(NODE_HELP)
- | '?'
- -> ^(NODE_HELP)
- ;
-
-exitStatement
- : QUIT -> ^(NODE_EXIT)
- | EXIT -> ^(NODE_EXIT)
- ;
-
-getStatement
- : GET columnFamilyExpr ('AS' typeIdentifier)? ('LIMIT' limit=IntegerPositiveLiteral)?
- -> ^(NODE_THRIFT_GET columnFamilyExpr ( ^(CONVERT_TO_TYPE typeIdentifier) )? ^(NODE_LIMIT $limit)?)
- | GET columnFamily 'WHERE' getCondition ('AND' getCondition)* ('LIMIT' limit=IntegerPositiveLiteral)?
- -> ^(NODE_THRIFT_GET_WITH_CONDITIONS columnFamily ^(CONDITIONS getCondition+) ^(NODE_LIMIT $limit)?)
- ;
-
-getCondition
- : columnOrSuperColumn operator value
- -> ^(CONDITION operator columnOrSuperColumn value)
- ;
-
-operator
- : '=' | '>' | '<' | '>=' | '<='
- ;
-
-typeIdentifier
- : Identifier | StringLiteral | IntegerPositiveLiteral
- ;
-
-setStatement
- : SET columnFamilyExpr '=' objectValue=value (WITH TTL '=' ttlValue=IntegerPositiveLiteral)?
- -> ^(NODE_THRIFT_SET columnFamilyExpr $objectValue ( $ttlValue )?)
- ;
-
-incrStatement
- : INCR columnFamilyExpr (BY byValue=incrementValue)?
- -> ^(NODE_THRIFT_INCR columnFamilyExpr ( $byValue )?)
- | DECR columnFamilyExpr (BY byValue=incrementValue)?
- -> ^(NODE_THRIFT_DECR columnFamilyExpr ( $byValue )?)
- ;
-
-countStatement
- : COUNT columnFamilyExpr
- -> ^(NODE_THRIFT_COUNT columnFamilyExpr)
- ;
-
-delStatement
- : DEL columnFamilyExpr
- -> ^(NODE_THRIFT_DEL columnFamilyExpr)
- ;
-
-showStatement
- : showClusterName
- | showVersion
- | showKeyspaces
- | showSchema
- ;
-
-listStatement
- : LIST columnFamily keyRangeExpr? rowLimitExpr? columnLimitExpr?
- -> ^(NODE_LIST columnFamily keyRangeExpr? rowLimitExpr? columnLimitExpr?)
- ;
-
-truncateStatement
- : TRUNCATE columnFamily
- -> ^(NODE_TRUNCATE columnFamily)
- ;
-
-assumeStatement
- : ASSUME columnFamily assumptionElement=Identifier 'AS' entityName
- -> ^(NODE_ASSUME columnFamily $assumptionElement entityName)
- ;
-
-consistencyLevelStatement
- : CONSISTENCYLEVEL 'AS' defaultType=Identifier
- -> ^(NODE_CONSISTENCY_LEVEL $defaultType)
- ;
-
-showClusterName
- : SHOW 'CLUSTER NAME'
- -> ^(NODE_SHOW_CLUSTER_NAME)
- ;
-
-addKeyspace
- : CREATE KEYSPACE keyValuePairExpr
- -> ^(NODE_ADD_KEYSPACE keyValuePairExpr)
- ;
-
-addColumnFamily
- : CREATE COLUMN FAMILY keyValuePairExpr
- -> ^(NODE_ADD_COLUMN_FAMILY keyValuePairExpr)
- ;
-
-updateKeyspace
- : UPDATE KEYSPACE keyValuePairExpr
- -> ^(NODE_UPDATE_KEYSPACE keyValuePairExpr)
- ;
-
-updateColumnFamily
- : UPDATE COLUMN FAMILY keyValuePairExpr
- -> ^(NODE_UPDATE_COLUMN_FAMILY keyValuePairExpr)
- ;
-
-delKeyspace
- : DROP KEYSPACE keyspace
- -> ^(NODE_DEL_KEYSPACE keyspace)
- ;
-
-delColumnFamily
- : DROP COLUMN FAMILY columnFamily
- -> ^(NODE_DEL_COLUMN_FAMILY columnFamily)
- ;
-
-dropIndex
- : DROP INDEX ON columnFamily '.' columnName
- -> ^(NODE_DROP_INDEX columnFamily columnName)
- ;
-
-showVersion
- : SHOW API_VERSION
- -> ^(NODE_SHOW_VERSION)
- ;
-
-showKeyspaces
- : SHOW KEYSPACES
- -> ^(NODE_SHOW_KEYSPACES)
- ;
-
-showSchema
- : SHOW SCHEMA (keyspace)?
- -> ^(NODE_SHOW_SCHEMA (keyspace)?)
- ;
-
-describeTable
- : DESCRIBE (keyspace)?
- -> ^(NODE_DESCRIBE (keyspace)?)
- ;
-
-describeCluster
- : DESCRIBE 'CLUSTER'
- -> ^(NODE_DESCRIBE_CLUSTER)
- ;
-
-useKeyspace
- : USE keyspace ( username )? ( password )?
- -> ^(NODE_USE_TABLE keyspace ( username )? ( password )?)
- ;
-
-traceNextQuery
- : TRACE NEXT QUERY
- -> ^(NODE_TRACE_NEXT_QUERY)
- ;
-
-setTraceProbability
- : SET TRACE PROBABILITY tracingProbability
- -> ^(NODE_SET_TRACE_PROBABILITY tracingProbability)
- ;
-
-keyValuePairExpr
- : entityName ( (AND | WITH) keyValuePair )*
- -> ^(NODE_NEW_KEYSPACE_ACCESS entityName ( keyValuePair )* )
- ;
-
-keyValuePair
- : attr_name '=' attrValue
- -> attr_name attrValue
- ;
-
-attrValue
- : arrayConstruct
- | hashConstruct
- | attrValueString
- | attrValueInt
- | attrValueDouble
- ;
-
-
-arrayConstruct
- : '[' (hashConstruct ','?)* ']'
- -> ^(ARRAY (hashConstruct)*)
- ;
-
-hashConstruct
- : '{' hashElementPair (',' hashElementPair)* '}'
- -> ^(HASH (hashElementPair)+)
- ;
-
-hashElementPair
- : rowKey ':' rowValue
- -> ^(PAIR rowKey rowValue)
- ;
-
-columnFamilyExpr
- : columnFamily '[' rowKey ']'
- ( '[' column=columnOrSuperColumn ']'
- ('[' super_column=columnOrSuperColumn ']')?
- )?
- -> ^(NODE_COLUMN_ACCESS columnFamily rowKey ($column ($super_column)? )?)
- ;
-
-keyRangeExpr
- : '[' ( startKey=entityName? ':' endKey=entityName? )? ']'
- -> ^(NODE_KEY_RANGE $startKey? $endKey?)
- ;
-
-rowLimitExpr
- : 'LIMIT' limit=IntegerPositiveLiteral
- -> ^(NODE_LIMIT $limit)
- ;
-
-columnLimitExpr
- : 'COLUMNS' columns=IntegerPositiveLiteral reversedExpr?
- -> ^(NODE_COLUMNS $columns reversedExpr?)
- ;
-
-reversedExpr
- : 'REVERSED'
- -> ^(NODE_REVERSED)
- ;
-
-columnName
- : entityName
- ;
-
-attr_name
- : Identifier
- ;
-
-attrValueString
- : (Identifier | StringLiteral)
- ;
-
-attrValueInt
- : IntegerPositiveLiteral
- | IntegerNegativeLiteral
- ;
-
-attrValueDouble
- : DoubleLiteral
- ;
-
-keyspace
- : entityName
- ;
-
-replica_placement_strategy
- : StringLiteral
- ;
-
-keyspaceNewName
- : entityName
- ;
-
-comparator
- : StringLiteral
- ;
-
-command : Identifier
- ;
-
-newColumnFamily
- : entityName
- ;
-
-username: Identifier
- ;
-
-password: StringLiteral
- ;
-
-columnFamily
- : entityName
- ;
-
-entityName
- : (Identifier | StringLiteral | IntegerPositiveLiteral | IntegerNegativeLiteral)
- ;
-
-rowKey
- : (Identifier | StringLiteral | IntegerPositiveLiteral | IntegerNegativeLiteral | functionCall)
- ;
-
-rowValue
- : (Identifier | StringLiteral | IntegerPositiveLiteral | IntegerNegativeLiteral | functionCall | hashConstruct)
- ;
-
-value
- : (Identifier | IntegerPositiveLiteral | IntegerNegativeLiteral | StringLiteral | functionCall)
- ;
-
-functionCall
- : functionName=Identifier '(' functionArgument? ')'
- -> ^(FUNCTION_CALL $functionName functionArgument?)
- ;
-
-functionArgument
- : Identifier | StringLiteral | IntegerPositiveLiteral | IntegerNegativeLiteral
- ;
-
-columnOrSuperColumn
- : (Identifier | IntegerPositiveLiteral | IntegerNegativeLiteral | StringLiteral | functionCall)
- ;
-
-host
- : host_name
- -> ^(NODE_ID_LIST host_name)
- ;
-
-host_name
- : Identifier ('.' Identifier)*
- ;
-
-ip_address
- : IP_ADDRESS
- -> ^(NODE_ID_LIST IP_ADDRESS)
- ;
-
-port
- : IntegerPositiveLiteral
- ;
-
-incrementValue
- : IntegerPositiveLiteral
- | IntegerNegativeLiteral
- ;
-
-traceSessionId
- : Identifier
- ;
-
-tracingProbability
- : DoubleLiteral
- ;
-
-//
-// Lexer Section
-//
-
-//
-// Keywords (in alphabetical order for convenience)
-//
-// CLI is case-insensitive with respect to these keywords.
-// However, they MUST be listed in upper case here.
-//
-CONFIG: 'CONFIG';
-CONNECT: 'CONNECT';
-COUNT: 'COUNT';
-DEL: 'DEL';
-DESCRIBE: 'DESCRIBE';
-USE: 'USE';
-TRACE: 'TRACE';
-PROBABILITY: 'PROBABILITY';
-NEXT: 'NEXT';
-QUERY: 'QUERY';
-GET: 'GET';
-HELP: 'HELP';
-EXIT: 'EXIT';
-FILE: 'FILE';
-QUIT: 'QUIT';
-SET: 'SET';
-INCR: 'INCR';
-DECR: 'DECR';
-SHOW: 'SHOW';
-KEYSPACE: 'KEYSPACE';
-KEYSPACES: 'KEYSPACES';
-API_VERSION: 'API VERSION';
-CREATE: 'CREATE';
-DROP: 'DROP';
-COLUMN: 'COLUMN';
-FAMILY: 'FAMILY';
-WITH: 'WITH';
-BY: 'BY';
-AND: 'AND';
-UPDATE: 'UPDATE';
-LIST: 'LIST';
-LIMIT: 'LIMIT';
-TRUNCATE: 'TRUNCATE';
-ASSUME: 'ASSUME';
-TTL: 'TTL';
-CONSISTENCYLEVEL: 'CONSISTENCYLEVEL';
-INDEX: 'INDEX';
-ON: 'ON';
-SCHEMA: 'SCHEMA';
-
-IP_ADDRESS
- : IntegerPositiveLiteral '.' IntegerPositiveLiteral '.' IntegerPositiveLiteral '.' IntegerPositiveLiteral
- ;
-
-// private syntactic rules
-fragment
-Letter
- : 'a'..'z'
- | 'A'..'Z'
- ;
-
-fragment
-Digit
- : '0'..'9'
- ;
-
-fragment
-Alnum
- : Letter
- | Digit
- ;
-
-// syntactic Elements
-IntegerPositiveLiteral
- : Digit+
- ;
-
-IntegerNegativeLiteral
- : '-' Digit+
- ;
-
-DoubleLiteral
- : Digit+ ('.' Digit+)?
- | ' ' '.' Digit+
- ;
-
-Identifier
- : (Letter | Alnum) (Alnum | '_' | '-' )*
- ;
-
-// literals
-StringLiteral
- : '\'' SingleStringCharacter* '\''
- ;
-
-fragment SingleStringCharacter
- : ~('\'' | '\\')
- | '\\' EscapeSequence
- ;
-
-fragment EscapeSequence
- : CharacterEscapeSequence
- | '0'
- | HexEscapeSequence
- | UnicodeEscapeSequence
- ;
-
-fragment CharacterEscapeSequence
- : SingleEscapeCharacter
- | NonEscapeCharacter
- ;
-
-fragment NonEscapeCharacter
- : ~(EscapeCharacter)
- ;
-
-fragment SingleEscapeCharacter
- : '\'' | '"' | '\\' | 'b' | 'f' | 'n' | 'r' | 't' | 'v'
- ;
-
-fragment EscapeCharacter
- : SingleEscapeCharacter
- | DecimalDigit
- | 'x'
- | 'u'
- ;
-
-fragment HexEscapeSequence
- : 'x' HexDigit HexDigit
- ;
-
-fragment UnicodeEscapeSequence
- : 'u' HexDigit HexDigit HexDigit HexDigit
- ;
-
-fragment HexDigit
- : DecimalDigit | ('a'..'f') | ('A'..'F')
- ;
-
-fragment DecimalDigit
- : ('0'..'9')
- ;
-
-//
-// syntactic elements
-//
-
-SEMICOLON
- : ';'
- ;
-
-WS
- : (' '|'\r'|'\t'|'\n') {$channel=HIDDEN;} // whitepace
- ;
-
-COMMENT
- : '--' (~('\n'|'\r'))* { $channel=HIDDEN; }
- | '/*' (options {greedy=false;} : .)* '*/' { $channel=HIDDEN; }
- ;