Merge branch cassandra-2.1 into cassandra-2.2

This commit is contained in:
blerer 2015-09-17 22:12:50 +02:00
commit eecfb07d46
7 changed files with 68 additions and 7 deletions

View File

@ -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
=====

View File

@ -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

View File

@ -1,6 +1,7 @@
<link rel="StyleSheet" href="CQL.css" type="text/css" media="screen">
h1. Cassandra Query Language (CQL) v3.3.0
h1. Cassandra Query Language (CQL) v3.3.1
<span id="tableOfContents">
@ -434,7 +435,7 @@ h3(#truncateStmt). TRUNCATE
__Syntax:__
bc(syntax). <truncate-stmt> ::= TRUNCATE <tablename>
bc(syntax). <truncate-stmt> ::= TRUNCATE ( TABLE | COLUMNFAMILY )? <tablename>
__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

View File

@ -996,7 +996,7 @@ def batch_opt_completer(ctxt, cass):
return opts
syntax_rules += r'''
<truncateStatement> ::= "TRUNCATE" cf=<columnFamilyName>
<truncateStatement> ::= "TRUNCATE" ("COLUMNFAMILY" | "TABLE")? cf=<columnFamilyName>
;
'''

View File

@ -844,7 +844,7 @@ dropIndexStatement returns [DropIndexStatement expr]
* TRUNCATE <CF>;
*/
truncateStatement returns [TruncateStatement stmt]
: K_TRUNCATE cf=columnFamilyName { $stmt = new TruncateStatement(cf); }
: K_TRUNCATE (K_COLUMNFAMILY)? cf=columnFamilyName { $stmt = new TruncateStatement(cf); }
;
/**

View File

@ -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();

View File

@ -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"));
}
}
}