diff --git a/NEWS.txt b/NEWS.txt
index 49744cf15d..78d90f6143 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -13,7 +13,6 @@ restore snapshots created with the previous major version using the
'sstableloader' tool. You can upgrade the file format of your snapshots
using the provided 'sstableupgrade' tool.
-
2.2.2
=====
@@ -144,6 +143,14 @@ New features
- SizeTieredCompactionStrategy parameter cold_reads_to_omit has been removed.
+2.1.10
+=====
+
+New features
+------------
+ - The syntax TRUNCATE TABLE X is now accepted as an alias for TRUNCATE X
+
+
2.1.9
=====
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 2636a596a7..81c998ccc7 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -134,7 +134,7 @@ from cqlshlib.util import get_file_encoding_bomsize, trim_if_present
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 9042
-DEFAULT_CQLVER = '3.3.0'
+DEFAULT_CQLVER = '3.3.1'
DEFAULT_PROTOCOL_VERSION = 4
DEFAULT_CONNECT_TIMEOUT_SECONDS = 5
diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile
index ce712bef8f..aa0468b8a7 100644
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@ -1,6 +1,7 @@
-h1. Cassandra Query Language (CQL) v3.3.0
+h1. Cassandra Query Language (CQL) v3.3.1
+
@@ -434,7 +435,7 @@ h3(#truncateStmt). TRUNCATE
__Syntax:__
-bc(syntax). ::= TRUNCATE
+bc(syntax). ::= TRUNCATE ( TABLE | COLUMNFAMILY )?
__Sample:__
@@ -2197,6 +2198,11 @@ h2(#changes). Changes
The following describes the changes in each version of CQL.
+
+h3. 3.3.1
+
+* The syntax @TRUNCATE TABLE X@ is now accepted as an alias for @TRUNCATE X@
+
h3. 3.3.0
* Adds new "aggregates":#aggregates
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index aff551a861..dcae173610 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -996,7 +996,7 @@ def batch_opt_completer(ctxt, cass):
return opts
syntax_rules += r'''
- ::= "TRUNCATE" cf=
+ ::= "TRUNCATE" ("COLUMNFAMILY" | "TABLE")? cf=
;
'''
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g b/src/java/org/apache/cassandra/cql3/Cql.g
index 17cef8b82d..ed10e7743e 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -844,7 +844,7 @@ dropIndexStatement returns [DropIndexStatement expr]
* TRUNCATE ;
*/
truncateStatement returns [TruncateStatement stmt]
- : K_TRUNCATE cf=columnFamilyName { $stmt = new TruncateStatement(cf); }
+ : K_TRUNCATE (K_COLUMNFAMILY)? cf=columnFamilyName { $stmt = new TruncateStatement(cf); }
;
/**
diff --git a/src/java/org/apache/cassandra/cql3/QueryProcessor.java b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
index e9ff1b19a1..161d8d0ff7 100644
--- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
@@ -56,7 +56,7 @@ import org.github.jamm.MemoryMeter;
public class QueryProcessor implements QueryHandler
{
- public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.3.0");
+ public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.3.1");
public static final QueryProcessor instance = new QueryProcessor();
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/TruncateTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/TruncateTest.java
new file mode 100644
index 0000000000..78a42fcb59
--- /dev/null
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/TruncateTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.cassandra.cql3.validation.operations;
+
+import org.junit.Test;
+
+import org.apache.cassandra.cql3.CQLTester;
+
+public class TruncateTest extends CQLTester
+{
+ @Test
+ public void testTruncate() throws Throwable
+ {
+ for (String table : new String[] { "", "TABLE" })
+ {
+ createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY(a, b))");
+
+ execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 0, 0);
+ execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 1, 1);
+
+ flush();
+
+ execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 1, 0, 2);
+ execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 1, 1, 3);
+
+ assertRows(execute("SELECT * FROM %s"), row(1, 0, 2), row(1, 1, 3), row(0, 0, 0), row(0, 1, 1));
+
+ execute("TRUNCATE " + table + " %s");
+
+ assertEmpty(execute("SELECT * FROM %s"));
+ }
+ }
+}