http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java 
b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
index d881e63..1dd0bc6 100644
--- a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
@@ -26,7 +26,7 @@ import org.apache.cassandra.cql3.CQLStatement;
 import org.apache.cassandra.cql3.ColumnSpecification;
 import org.apache.cassandra.cql3.QueryHandler;
 import org.apache.cassandra.cql3.QueryOptions;
-import org.apache.cassandra.cql3.statements.ParsedStatement;
+import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.exceptions.PreparedQueryNotFoundException;
 import org.apache.cassandra.service.ClientState;
 import org.apache.cassandra.service.QueryState;
@@ -92,12 +92,12 @@ public class ExecuteMessage extends Message.Request
         try
         {
             QueryHandler handler = ClientState.getCQLQueryHandler();
-            ParsedStatement.Prepared prepared = 
handler.getPrepared(statementId);
+            QueryProcessor.Prepared prepared = 
handler.getPrepared(statementId);
             if (prepared == null)
                 throw new PreparedQueryNotFoundException(statementId);
 
-            options.prepare(prepared.boundNames);
             CQLStatement statement = prepared.statement;
+            options.prepare(statement.getBindVariables());
 
             if (options.getPageSize() == 0)
                 throw new ProtocolException("The page size cannot be 0");
@@ -122,9 +122,9 @@ public class ExecuteMessage extends Message.Request
                     builder.put("serial_consistency_level", 
options.getSerialConsistency().name());
                 builder.put("query", prepared.rawCQLStatement);
 
-                for(int i=0;i<prepared.boundNames.size();i++)
+                for(int i = 0; i < statement.getBindVariables().size(); i++)
                 {
-                    ColumnSpecification cs = prepared.boundNames.get(i);
+                    ColumnSpecification cs = 
statement.getBindVariables().get(i);
                     String boundName = cs.name.toString();
                     String boundValue = 
cs.type.asCQL3Type().toCQLLiteral(options.getValues().get(i), 
options.getProtocolVersion());
                     if ( boundValue.length() > 1000 )
@@ -142,7 +142,7 @@ public class ExecuteMessage extends Message.Request
 
             // Some custom QueryHandlers are interested by the bound names. We 
provide them this information
             // by wrapping the QueryOptions.
-            QueryOptions queryOptions = 
QueryOptions.addColumnSpecifications(options, prepared.boundNames);
+            QueryOptions queryOptions = 
QueryOptions.addColumnSpecifications(options, statement.getBindVariables());
             Message.Response response = handler.processPrepared(statement, 
state, queryOptions, getCustomPayload(), queryStartNanoTime);
             if (options.skipMetadata() && response instanceof 
ResultMessage.Rows)
                 
((ResultMessage.Rows)response).result.metadata.setSkipMetadata();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/src/java/org/apache/cassandra/transport/messages/ResultMessage.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/transport/messages/ResultMessage.java 
b/src/java/org/apache/cassandra/transport/messages/ResultMessage.java
index e1ea948..a04f4ff 100644
--- a/src/java/org/apache/cassandra/transport/messages/ResultMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ResultMessage.java
@@ -23,7 +23,6 @@ import io.netty.buffer.ByteBuf;
 import org.apache.cassandra.cql3.CQLStatement;
 import org.apache.cassandra.cql3.ResultSet;
 import org.apache.cassandra.cql3.statements.SelectStatement;
-import org.apache.cassandra.cql3.statements.ParsedStatement;
 import org.apache.cassandra.transport.*;
 import org.apache.cassandra.utils.MD5Digest;
 
@@ -260,9 +259,9 @@ public abstract class ResultMessage extends Message.Response
         /** Describes the results of executing this prepared statement */
         public final ResultSet.ResultMetadata resultMetadata;
 
-        public Prepared(MD5Digest statementId, ParsedStatement.Prepared 
prepared)
+        public Prepared(MD5Digest statementId, CQLStatement prepared)
         {
-            this(statementId, new 
ResultSet.PreparedMetadata(prepared.boundNames, 
prepared.partitionKeyBindIndexes), extractResultMetadata(prepared.statement));
+            this(statementId, new 
ResultSet.PreparedMetadata(prepared.getBindVariables(), 
prepared.getPartitionKeyBindVariableIndexes()), 
extractResultMetadata(prepared));
         }
 
         private Prepared(MD5Digest statementId, ResultSet.PreparedMetadata 
metadata, ResultSet.ResultMetadata resultMetadata)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java 
b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
index 906b342..3442a9c 100644
--- a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
+++ b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
@@ -247,11 +247,11 @@ public class TriggerExecutor
         }
     }
 
-    public synchronized ITrigger loadTriggerInstance(String triggerName) 
throws Exception
+    public synchronized ITrigger loadTriggerInstance(String triggerClass) 
throws Exception
     {
         // double check.
-        if (cachedTriggers.get(triggerName) != null)
-            return cachedTriggers.get(triggerName);
-        return (ITrigger) 
customClassLoader.loadClass(triggerName).getConstructor().newInstance();
+        if (cachedTriggers.get(triggerClass) != null)
+            return cachedTriggers.get(triggerClass);
+        return (ITrigger) 
customClassLoader.loadClass(triggerClass).getConstructor().newInstance();
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/microbench/org/apache/cassandra/test/microbench/MutationBench.java
----------------------------------------------------------------------
diff --git 
a/test/microbench/org/apache/cassandra/test/microbench/MutationBench.java 
b/test/microbench/org/apache/cassandra/test/microbench/MutationBench.java
index 45ad258..4a0e646 100644
--- a/test/microbench/org/apache/cassandra/test/microbench/MutationBench.java
+++ b/test/microbench/org/apache/cassandra/test/microbench/MutationBench.java
@@ -25,7 +25,7 @@ import java.util.Collection;
 import java.util.concurrent.*;
 
 import org.apache.cassandra.UpdateBuilder;
-import org.apache.cassandra.cql3.statements.CreateTableStatement;
+import org.apache.cassandra.cql3.statements.schema.CreateTableStatement;
 import org.apache.cassandra.schema.TableMetadata;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.schema.Schema;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/SchemaLoader.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/SchemaLoader.java 
b/test/unit/org/apache/cassandra/SchemaLoader.java
index d8f21e8..6e75fee 100644
--- a/test/unit/org/apache/cassandra/SchemaLoader.java
+++ b/test/unit/org/apache/cassandra/SchemaLoader.java
@@ -21,7 +21,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.*;
 
-import org.apache.cassandra.cql3.statements.CreateTableStatement;
+import org.apache.cassandra.cql3.statements.schema.CreateTableStatement;
 import org.apache.cassandra.dht.Murmur3Partitioner;
 import org.apache.cassandra.index.sasi.SASIIndex;
 import org.apache.cassandra.index.sasi.disk.OnDiskIndexBuilder;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/CQLTester.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/CQLTester.java 
b/test/unit/org/apache/cassandra/cql3/CQLTester.java
index 5a73c8d..d2ec42a 100644
--- a/test/unit/org/apache/cassandra/cql3/CQLTester.java
+++ b/test/unit/org/apache/cassandra/cql3/CQLTester.java
@@ -49,7 +49,6 @@ import org.apache.cassandra.schema.*;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.cql3.functions.FunctionName;
 import org.apache.cassandra.cql3.functions.ThreadAwareSecurityManager;
-import org.apache.cassandra.cql3.statements.ParsedStatement;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.marshal.*;
@@ -59,6 +58,8 @@ import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.locator.AbstractEndpointSnitch;
+import org.apache.cassandra.schema.IndexMetadata;
+import org.apache.cassandra.schema.KeyspaceMetadata;
 import org.apache.cassandra.schema.TableMetadata;
 import org.apache.cassandra.serializers.TypeSerializer;
 import org.apache.cassandra.service.ClientState;
@@ -678,7 +679,13 @@ public abstract class CQLTester
             throw new IllegalArgumentException("Table name should be 
specified: " + formattedQuery);
 
         String column = matcher.group(9);
-        return Indexes.getAvailableIndexName(keyspace, table, 
Strings.isNullOrEmpty(column) ? null : column);
+
+        String baseName = Strings.isNullOrEmpty(column)
+                        ? IndexMetadata.generateDefaultIndexName(table)
+                        : IndexMetadata.generateDefaultIndexName(table, new 
ColumnIdentifier(column, true));
+
+        KeyspaceMetadata ks = Schema.instance.getKeyspaceMetadata(keyspace);
+        return ks.findAvailableIndexName(baseName);
     }
 
     /**
@@ -742,16 +749,15 @@ public abstract class CQLTester
     {
         try
         {
-            ClientState state = ClientState.forInternalCalls();
-            state.setKeyspace(SchemaConstants.SYSTEM_KEYSPACE_NAME);
+            ClientState state = 
ClientState.forInternalCalls(SchemaConstants.SYSTEM_KEYSPACE_NAME);
             QueryState queryState = new QueryState(state);
 
-            ParsedStatement.Prepared prepared = 
QueryProcessor.parseStatement(query, queryState.getClientState());
-            prepared.statement.validate(state);
+            CQLStatement statement = QueryProcessor.parseStatement(query, 
queryState.getClientState());
+            statement.validate(state);
 
             QueryOptions options = 
QueryOptions.forInternalCalls(Collections.<ByteBuffer>emptyList());
 
-            lastSchemaChangeResult = 
prepared.statement.executeInternal(queryState, options);
+            lastSchemaChangeResult = statement.executeLocally(queryState, 
options);
         }
         catch (Exception e)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/PstmtPersistenceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/PstmtPersistenceTest.java 
b/test/unit/org/apache/cassandra/cql3/PstmtPersistenceTest.java
index fb577ec..1641663 100644
--- a/test/unit/org/apache/cassandra/cql3/PstmtPersistenceTest.java
+++ b/test/unit/org/apache/cassandra/cql3/PstmtPersistenceTest.java
@@ -26,7 +26,6 @@ import org.junit.Test;
 
 import junit.framework.Assert;
 import org.apache.cassandra.schema.SchemaConstants;
-import org.apache.cassandra.cql3.statements.ParsedStatement;
 import org.apache.cassandra.db.SystemKeyspace;
 import org.apache.cassandra.db.marshal.Int32Type;
 import org.apache.cassandra.db.marshal.UTF8Type;
@@ -92,7 +91,7 @@ public class PstmtPersistenceTest extends CQLTester
         for (UntypedResultSet.Row row : 
QueryProcessor.executeOnceInternal(queryAll))
         {
             MD5Digest digest = 
MD5Digest.wrap(ByteBufferUtil.getArray(row.getBytes("prepared_id")));
-            ParsedStatement.Prepared prepared = 
QueryProcessor.instance.getPrepared(digest);
+            QueryProcessor.Prepared prepared = 
QueryProcessor.instance.getPrepared(digest);
             Assert.assertNotNull(prepared);
         }
 
@@ -124,7 +123,7 @@ public class PstmtPersistenceTest extends CQLTester
 
     private static void validatePstmt(QueryHandler handler, MD5Digest stmtId, 
QueryOptions options)
     {
-        ParsedStatement.Prepared prepared = handler.getPrepared(stmtId);
+        QueryProcessor.Prepared prepared = handler.getPrepared(stmtId);
         Assert.assertNotNull(prepared);
         handler.processPrepared(prepared.statement, 
QueryState.forInternalCalls(), options, Collections.emptyMap(), 
System.nanoTime());
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java 
b/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
index ea07f90..205987a 100644
--- a/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
@@ -1526,7 +1526,7 @@ public class ViewFilteringTest extends CQLTester
         executeNet(protocolVersion, "USE " + keyspace());
 
         try {
-            createView("mv_test", "CREATE MATERIALIZED VIEW %s AS SELECT * 
FROM %%s WHERE b IS NOT NULL AND c IS NOT NULL AND d = 1 PRIMARY KEY (a, b, 
c)");
+            createView("mv_test", "CREATE MATERIALIZED VIEW %s AS SELECT * 
FROM %%s WHERE a IS NOT NULL AND b IS NOT NULL AND c IS NOT NULL AND d = 1 
PRIMARY KEY (a, b, c)");
             dropView("mv_test");
         } catch(Exception e) {
             throw new RuntimeException("MV creation with non primary column 
restrictions failed.", e);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/ViewSchemaTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/ViewSchemaTest.java 
b/test/unit/org/apache/cassandra/cql3/ViewSchemaTest.java
index 8d2f3da..8b9fd9e 100644
--- a/test/unit/org/apache/cassandra/cql3/ViewSchemaTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ViewSchemaTest.java
@@ -672,7 +672,7 @@ public class ViewSchemaTest extends CQLTester
         executeNet(protocolVersion, "USE " + keyspace());
 
         createView(keyspace() + ".mv1",
-                   "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE b 
IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, b, c)");
+                   "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE a 
IS NOT NULL AND b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, b, c)");
 
         try
         {
@@ -681,7 +681,7 @@ public class ViewSchemaTest extends CQLTester
         }
         catch (InvalidQueryException e)
         {
-            Assert.assertEquals("Cannot use DROP TABLE on Materialized View", 
e.getMessage());
+            Assert.assertEquals("Cannot use DROP TABLE on a materialized view. 
Please use DROP MATERIALIZED VIEW instead.", e.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/ViewTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/ViewTest.java 
b/test/unit/org/apache/cassandra/cql3/ViewTest.java
index 54901b3..1528651 100644
--- a/test/unit/org/apache/cassandra/cql3/ViewTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ViewTest.java
@@ -93,8 +93,8 @@ public class ViewTest extends CQLTester
     @Test
     public void testNonExistingOnes() throws Throwable
     {
-        assertInvalidMessage("Cannot drop non existing materialized view", 
"DROP MATERIALIZED VIEW " + KEYSPACE + ".view_does_not_exist");
-        assertInvalidMessage("Cannot drop non existing materialized view", 
"DROP MATERIALIZED VIEW keyspace_does_not_exist.view_does_not_exist");
+        assertInvalidMessage(String.format("Materialized view 
'%s.view_does_not_exist' doesn't exist", KEYSPACE), "DROP MATERIALIZED VIEW " + 
KEYSPACE + ".view_does_not_exist");
+        assertInvalidMessage("Materialized view 
'keyspace_does_not_exist.view_does_not_exist' doesn't exist", "DROP 
MATERIALIZED VIEW keyspace_does_not_exist.view_does_not_exist");
 
         execute("DROP MATERIALIZED VIEW IF EXISTS " + KEYSPACE + 
".view_does_not_exist");
         execute("DROP MATERIALIZED VIEW IF EXISTS 
keyspace_does_not_exist.view_does_not_exist");
@@ -108,7 +108,7 @@ public class ViewTest extends CQLTester
         execute("USE " + keyspace());
         executeNet(protocolVersion, "USE " + keyspace());
 
-        createView("view1", "CREATE MATERIALIZED VIEW view1 AS SELECT k1 FROM 
%%s WHERE k1 IS NOT NULL AND c1 IS NOT NULL AND val IS NOT NULL PRIMARY KEY 
(val, k1, c1)");
+        createView("view1", "CREATE MATERIALIZED VIEW view1 AS SELECT k1, c1, 
val FROM %%s WHERE k1 IS NOT NULL AND c1 IS NOT NULL AND val IS NOT NULL 
PRIMARY KEY (val, k1, c1)");
 
         updateView("INSERT INTO %s (k1, c1, val) VALUES (1, 2, 200)");
         updateView("INSERT INTO %s (k1, c1, val) VALUES (1, 3, 300)");
@@ -131,7 +131,7 @@ public class ViewTest extends CQLTester
         execute("USE " + keyspace());
         executeNet(protocolVersion, "USE " + keyspace());
 
-        createView("view1", "CREATE MATERIALIZED VIEW view1 AS SELECT k1 FROM 
%%s WHERE k1 IS NOT NULL AND c1 IS NOT NULL AND val IS NOT NULL PRIMARY KEY 
(val, k1, c1)");
+        createView("view1", "CREATE MATERIALIZED VIEW view1 AS SELECT val, k1, 
c1 FROM %%s WHERE k1 IS NOT NULL AND c1 IS NOT NULL AND val IS NOT NULL PRIMARY 
KEY (val, k1, c1)");
 
     }
 
@@ -143,7 +143,7 @@ public class ViewTest extends CQLTester
         execute("USE " + keyspace());
         executeNet(protocolVersion, "USE " + keyspace());
 
-        createView("view1", "CREATE MATERIALIZED VIEW view1 AS SELECT k1 FROM 
%%s WHERE k1 IS NOT NULL AND c1 IS NOT NULL AND val IS NOT NULL PRIMARY KEY 
(val, k1, c1)");
+        createView("view1", "CREATE MATERIALIZED VIEW view1 AS SELECT k1, c1, 
val FROM %%s WHERE k1 IS NOT NULL AND c1 IS NOT NULL AND val IS NOT NULL 
PRIMARY KEY (val, k1, c1)");
 
         updateView("INSERT INTO %s (k1, c1, val) VALUES (1, 2, 200)");
         updateView("INSERT INTO %s (k1, c1, val) VALUES (1, 3, 300)");
@@ -205,8 +205,15 @@ public class ViewTest extends CQLTester
         {
         }
 
-        // Can omit "k IS NOT NULL" because we have a sinlge partition key
-        createView("mv_test", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM 
%%s WHERE bigintval IS NOT NULL AND asciival IS NOT NULL PRIMARY KEY 
(bigintval, k, asciival)");
+        // Must still include both even when the partition key is composite
+        try
+        {
+            createView("mv_test", "CREATE MATERIALIZED VIEW %s AS SELECT * 
FROM %%s WHERE bigintval IS NOT NULL AND asciival IS NOT NULL PRIMARY KEY 
(bigintval, k, asciival)");
+            Assert.fail("Should fail if compound primary is not completely 
filtered as NOT NULL");
+        }
+        catch (Exception e)
+        {
+        }
     }
 
     @Test
@@ -369,7 +376,7 @@ public class ViewTest extends CQLTester
         }
         catch (InvalidQueryException e)
         {
-            Assert.assertEquals("Cannot use Duration column 'result' in 
PRIMARY KEY of materialized view", e.getMessage());
+            Assert.assertEquals("duration type is not supported for PRIMARY 
KEY column 'result'", e.getMessage());
         }
     }
 
@@ -712,7 +719,7 @@ public class ViewTest extends CQLTester
             {
                 String query = "CREATE MATERIALIZED VIEW %s AS SELECT * FROM 
%%s WHERE " + def.name + " IS NOT NULL AND k IS NOT NULL "
                                + (def.name.toString().equals("asciival") ? "" 
: "AND asciival IS NOT NULL ") + "PRIMARY KEY ((" + def.name + ", k), 
nonexistentcolumn)";
-                createView("mv3_" + def.name, query);
+                createView("mv4_" + def.name, query);
                 Assert.fail("Should fail with unknown base column");
             }
             catch (InvalidQueryException e)
@@ -942,10 +949,10 @@ public class ViewTest extends CQLTester
 
         executeNet(protocolVersion, "USE " + keyspace());
 
-        createView("mv1", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, b, c) WITH CLUSTERING 
ORDER BY (b DESC)");
-        createView("mv2", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, c, b) WITH CLUSTERING 
ORDER BY (c ASC)");
-        createView("mv3", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, b, c)");
-        createView("mv4", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, c, b) WITH CLUSTERING 
ORDER BY (c DESC)");
+        createView("mv1", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE a IS NOT NULL AND b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, b, c) 
WITH CLUSTERING ORDER BY (b DESC, c ASC)");
+        createView("mv2", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE a IS NOT NULL AND b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, c, b) 
WITH CLUSTERING ORDER BY (c ASC, b ASC)");
+        createView("mv3", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE a IS NOT NULL AND b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, b, c)");
+        createView("mv4", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE a IS NOT NULL AND b IS NOT NULL AND c IS NOT NULL PRIMARY KEY (a, c, b) 
WITH CLUSTERING ORDER BY (c DESC, b ASC)");
 
         updateView("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 1, 1, 
1);
         updateView("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 2, 2, 
2);
@@ -981,7 +988,7 @@ public class ViewTest extends CQLTester
 
         executeNet(protocolVersion, "USE " + keyspace());
 
-        createView("mv1", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE b IS NOT NULL PRIMARY KEY (b, a)");
+        createView("mv1", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s 
WHERE a IS NOT NULL AND b IS NOT NULL PRIMARY KEY (b, a)");
 
         updateView("INSERT INTO %s (a, b) VALUES (?, ?)", 1, 1);
         updateView("INSERT INTO %s (a, b) VALUES (?, ?)", 1, 2);
@@ -1013,7 +1020,7 @@ public class ViewTest extends CQLTester
         executeNet(protocolVersion, "USE " + keyspace());
 
         // Cannot use SELECT *, as those are always handled by the includeAll 
shortcut in View.updateAffectsView
-        createView("mv1", "CREATE MATERIALIZED VIEW %s AS SELECT a, b FROM %%s 
WHERE b IS NOT NULL PRIMARY KEY (b, a)");
+        createView("mv1", "CREATE MATERIALIZED VIEW %s AS SELECT a, b FROM %%s 
WHERE a IS NOT NULL AND b IS NOT NULL PRIMARY KEY (b, a)");
 
         updateView("INSERT INTO %s (a, b) VALUES (?, ?)", 1, 1);
 
@@ -1102,7 +1109,7 @@ public class ViewTest extends CQLTester
                     "PRIMARY KEY (a))");
 
         executeNet(protocolVersion, "USE " + keyspace());
-        createView("mvmap", "CREATE MATERIALIZED VIEW %s AS SELECT a, b FROM 
%%s WHERE b IS NOT NULL PRIMARY KEY (b, a)");
+        createView("mvmap", "CREATE MATERIALIZED VIEW %s AS SELECT a, b FROM 
%%s WHERE a IS NOT NULL AND b IS NOT NULL PRIMARY KEY (b, a)");
 
         updateView("INSERT INTO %s (a, b) VALUES (?, ?)", 0, 0);
         ResultSet mvRows = executeNet(protocolVersion, "SELECT a, b FROM mvmap 
WHERE b = ?", 0);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/selection/SelectionColumnMappingTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/selection/SelectionColumnMappingTest.java 
b/test/unit/org/apache/cassandra/cql3/selection/SelectionColumnMappingTest.java
index 30fbb0d..d6de5ff 100644
--- 
a/test/unit/org/apache/cassandra/cql3/selection/SelectionColumnMappingTest.java
+++ 
b/test/unit/org/apache/cassandra/cql3/selection/SelectionColumnMappingTest.java
@@ -124,7 +124,7 @@ public class SelectionColumnMappingTest extends CQLTester
         // we don't use verify like with the other tests because this query 
will produce no results
         SelectStatement statement = getSelect("SELECT token(a,b) FROM %s");
         verifyColumnMapping(expected, statement);
-        statement.executeInternal(QueryState.forInternalCalls(), 
QueryOptions.DEFAULT);
+        statement.executeLocally(QueryState.forInternalCalls(), 
QueryOptions.DEFAULT);
     }
 
     private void testSimpleTypes() throws Throwable
@@ -581,8 +581,8 @@ public class SelectionColumnMappingTest extends CQLTester
     private void checkExecution(SelectStatement statement, 
List<ColumnSpecification> expectedResultColumns)
     throws RequestExecutionException, RequestValidationException
     {
-        UntypedResultSet rs = 
UntypedResultSet.create(statement.executeInternal(QueryState.forInternalCalls(),
-                                                                               
 QueryOptions.DEFAULT).result);
+        UntypedResultSet rs = 
UntypedResultSet.create(statement.executeLocally(QueryState.forInternalCalls(),
+                                                                               
QueryOptions.DEFAULT).result);
 
         assertEquals(expectedResultColumns, rs.one().getColumns());
     }
@@ -590,7 +590,7 @@ public class SelectionColumnMappingTest extends CQLTester
     private SelectStatement getSelect(String query) throws 
RequestValidationException
     {
         CQLStatement statement = 
QueryProcessor.getStatement(String.format(query, KEYSPACE + "." + tableName),
-                                                             
ClientState.forInternalCalls()).statement;
+                                                             
ClientState.forInternalCalls());
         assertTrue(statement instanceof SelectStatement);
         return (SelectStatement)statement;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/CountersTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/CountersTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/entities/CountersTest.java
index 94e1c52..383fbb8 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/CountersTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/CountersTest.java
@@ -208,7 +208,7 @@ public class CountersTest extends CQLTester
     @Test
     public void testProhibitReversedCounterAsPartOfPrimaryKey() throws 
Throwable
     {
-        assertInvalidThrowMessage("counter type is not supported for PRIMARY 
KEY part a",
+        assertInvalidThrowMessage("counter type is not supported for PRIMARY 
KEY column 'a'",
                                   InvalidRequestException.class, 
String.format("CREATE TABLE %s.%s (a counter, b int, PRIMARY KEY (b, a)) WITH 
CLUSTERING ORDER BY (a desc);", KEYSPACE, createTableName()));
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/FrozenCollectionsTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/FrozenCollectionsTest.java
 
b/test/unit/org/apache/cassandra/cql3/validation/entities/FrozenCollectionsTest.java
index e50528b..7d078ee 100644
--- 
a/test/unit/org/apache/cassandra/cql3/validation/entities/FrozenCollectionsTest.java
+++ 
b/test/unit/org/apache/cassandra/cql3/validation/entities/FrozenCollectionsTest.java
@@ -563,8 +563,8 @@ public class FrozenCollectionsTest extends CQLTester
         createTable("CREATE TABLE %s (a frozen<map<int, text>> PRIMARY KEY, b 
frozen<map<int, text>>)");
 
         // for now, we don't support indexing values or keys of collections in 
the primary key
-        assertInvalidIndexCreationWithMessage("CREATE INDEX ON %s (full(a))", 
"Cannot create secondary index on partition key column");
-        assertInvalidIndexCreationWithMessage("CREATE INDEX ON %s (keys(a))", 
"Cannot create secondary index on partition key column");
+        assertInvalidIndexCreationWithMessage("CREATE INDEX ON %s (full(a))", 
"Cannot create secondary index on the only partition key column");
+        assertInvalidIndexCreationWithMessage("CREATE INDEX ON %s (keys(a))", 
"Cannot create secondary index on the only partition key column");
         assertInvalidIndexCreationWithMessage("CREATE INDEX ON %s (keys(b))", 
"Cannot create keys() index on frozen column b. " +
                                                                               
"Frozen collections only support full() indexes");
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
 
b/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
index 29ceb3b..6f3733c 100644
--- 
a/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
+++ 
b/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
@@ -25,6 +25,7 @@ import java.util.concurrent.CountDownLatch;
 import org.apache.commons.lang3.StringUtils;
 import org.junit.Test;
 
+import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.schema.ColumnMetadata;
 import org.apache.cassandra.schema.TableMetadata;
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -38,7 +39,6 @@ import org.apache.cassandra.db.DeletionTime;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.rows.Cell;
 import org.apache.cassandra.db.rows.Row;
-import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.index.IndexNotAvailableException;
 import org.apache.cassandra.index.SecondaryIndexManager;
@@ -52,6 +52,8 @@ import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.MD5Digest;
 import org.apache.cassandra.utils.Pair;
 
+import static java.lang.String.format;
+
 import static org.apache.cassandra.Util.throwAssert;
 import static org.apache.cassandra.utils.ByteBufferUtil.EMPTY_BYTE_BUFFER;
 import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
@@ -96,17 +98,17 @@ public class SecondaryIndexTest extends CQLTester
      */
     private void testCreateAndDropIndex(String indexName, boolean 
addKeyspaceOnDrop) throws Throwable
     {
-        execute("USE system");
-        assertInvalidMessage(String.format("Index '%s' could not be found",
-                                           
removeQuotes(indexName.toLowerCase(Locale.US))),
-                             "DROP INDEX " + indexName + ";");
+        assertInvalidMessage(format("Index '%s.%s' doesn't exist",
+                                    KEYSPACE,
+                                    
removeQuotes(indexName.toLowerCase(Locale.US))),
+                             format("DROP INDEX %s.%s", KEYSPACE, indexName));
 
         createTable("CREATE TABLE %s (a int primary key, b int);");
         createIndex("CREATE INDEX " + indexName + " ON %s(b);");
         createIndex("CREATE INDEX IF NOT EXISTS " + indexName + " ON %s(b);");
 
-        assertInvalidMessage(String.format("Index %s already exists",
-                                           
removeQuotes(indexName.toLowerCase(Locale.US))),
+        assertInvalidMessage(format("Index '%s' already exists",
+                                    
removeQuotes(indexName.toLowerCase(Locale.US))),
                              "CREATE INDEX " + indexName + " ON %s(b)");
 
         // IF NOT EXISTS should apply in cases where the new index differs 
from an existing one in name only
@@ -114,9 +116,9 @@ public class SecondaryIndexTest extends CQLTester
         assertEquals(1, 
getCurrentColumnFamilyStore().metadata().indexes.size());
         createIndex("CREATE INDEX IF NOT EXISTS " + otherIndexName + " ON 
%s(b)");
         assertEquals(1, 
getCurrentColumnFamilyStore().metadata().indexes.size());
-        assertInvalidMessage(String.format("Index %s is a duplicate of 
existing index %s",
-                                           
removeQuotes(otherIndexName.toLowerCase(Locale.US)),
-                                           
removeQuotes(indexName.toLowerCase(Locale.US))),
+        assertInvalidMessage(format("Index %s is a duplicate of existing index 
%s",
+                                    
removeQuotes(otherIndexName.toLowerCase(Locale.US)),
+                                    
removeQuotes(indexName.toLowerCase(Locale.US))),
                              "CREATE INDEX " + otherIndexName + " ON %s(b)");
 
         execute("INSERT INTO %s (a, b) values (?, ?);", 0, 0);
@@ -125,26 +127,24 @@ public class SecondaryIndexTest extends CQLTester
         execute("INSERT INTO %s (a, b) values (?, ?);", 3, 1);
 
         assertRows(execute("SELECT * FROM %s where b = ?", 1), row(1, 1), 
row(3, 1));
-        assertInvalidMessage(String.format("Index '%s' could not be found in 
any of the tables of keyspace 'system'",
-                                           
removeQuotes(indexName.toLowerCase(Locale.US))),
-                             "DROP INDEX " + indexName);
 
         if (addKeyspaceOnDrop)
         {
-            dropIndex("DROP INDEX " + KEYSPACE + "." + indexName);
+            dropIndex(format("DROP INDEX %s.%s", KEYSPACE, indexName));
         }
         else
         {
             execute("USE " + KEYSPACE);
-            execute("DROP INDEX " + indexName);
+            execute(format("DROP INDEX %s", indexName));
         }
 
         
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
                              "SELECT * FROM %s where b = ?", 1);
-        dropIndex("DROP INDEX IF EXISTS " + indexName);
-        assertInvalidMessage(String.format("Index '%s' could not be found",
-                                           
removeQuotes(indexName.toLowerCase(Locale.US))),
-                             "DROP INDEX " + indexName);
+        dropIndex(format("DROP INDEX IF EXISTS %s.%s", KEYSPACE, indexName));
+        assertInvalidMessage(format("Index '%s.%s' doesn't exist",
+                                    KEYSPACE,
+                                    
removeQuotes(indexName.toLowerCase(Locale.US))),
+                             format("DROP INDEX %s.%s", KEYSPACE, indexName));
     }
 
     /**
@@ -239,10 +239,10 @@ public class SecondaryIndexTest extends CQLTester
     public void testUnknownCompressionOptions() throws Throwable
     {
         String tableName = createTableName();
-        assertInvalidThrow(SyntaxException.class, String.format("CREATE TABLE 
%s (key varchar PRIMARY KEY, password varchar, gender varchar) WITH 
compression_parameters:sstable_compressor = 'DeflateCompressor'", tableName));
+        assertInvalidThrow(SyntaxException.class, format("CREATE TABLE %s (key 
varchar PRIMARY KEY, password varchar, gender varchar) WITH 
compression_parameters:sstable_compressor = 'DeflateCompressor'", tableName));
 
-        assertInvalidThrow(ConfigurationException.class, String.format("CREATE 
TABLE %s (key varchar PRIMARY KEY, password varchar, gender varchar) WITH 
compression = { 'sstable_compressor': 'DeflateCompressor' }",
-                                                                       
tableName));
+        assertInvalidThrow(ConfigurationException.class, format("CREATE TABLE 
%s (key varchar PRIMARY KEY, password varchar, gender varchar) WITH compression 
= { 'sstable_compressor': 'DeflateCompressor' }",
+                                                                tableName));
     }
 
     /**
@@ -558,14 +558,14 @@ public class SecondaryIndexTest extends CQLTester
     {
         String indexName = columnName + "_idx";
         SecondaryIndexManager indexManager = 
getCurrentColumnFamilyStore().indexManager;
-        createIndex(String.format("CREATE INDEX %s on %%s(%s)", indexName, 
columnName));
+        createIndex(format("CREATE INDEX %s on %%s(%s)", indexName, 
columnName));
         IndexMetadata indexDef = 
indexManager.getIndexByName(indexName).getIndexMetadata();
-        assertEquals(String.format("values(%s)", columnName), 
indexDef.options.get(IndexTarget.TARGET_OPTION_NAME));
-        dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
+        assertEquals(format("values(%s)", columnName), 
indexDef.options.get(IndexTarget.TARGET_OPTION_NAME));
+        dropIndex(format("DROP INDEX %s.%s", KEYSPACE, indexName));
         assertFalse(indexManager.hasIndexes());
-        createIndex(String.format("CREATE INDEX %s on %%s(values(%s))", 
indexName, columnName));
+        createIndex(format("CREATE INDEX %s on %%s(values(%s))", indexName, 
columnName));
         assertEquals(indexDef, 
indexManager.getIndexByName(indexName).getIndexMetadata());
-        dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
+        dropIndex(format("DROP INDEX %s.%s", KEYSPACE, indexName));
     }
 
     @Test
@@ -594,15 +594,15 @@ public class SecondaryIndexTest extends CQLTester
     private void createAndDropIndexWithQuotedColumnIdentifier(String target) 
throws Throwable
     {
         String indexName = "test_mixed_case_idx";
-        createIndex(String.format("CREATE INDEX %s ON %%s(%s)", indexName, 
target));
+        createIndex(format("CREATE INDEX %s ON %%s(%s)", indexName, target));
         SecondaryIndexManager indexManager = 
getCurrentColumnFamilyStore().indexManager;
         IndexMetadata indexDef = 
indexManager.getIndexByName(indexName).getIndexMetadata();
-        dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
+        dropIndex(format("DROP INDEX %s.%s", KEYSPACE, indexName));
         // verify we can re-create the index using the target string
-        createIndex(String.format("CREATE INDEX %s ON %%s(%s)",
-                                  indexName, 
indexDef.options.get(IndexTarget.TARGET_OPTION_NAME)));
+        createIndex(format("CREATE INDEX %s ON %%s(%s)",
+                           indexName, 
indexDef.options.get(IndexTarget.TARGET_OPTION_NAME)));
         assertEquals(indexDef, 
indexManager.getIndexByName(indexName).getIndexMetadata());
-        dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
+        dropIndex(format("DROP INDEX %s.%s", KEYSPACE, indexName));
     }
 
 
@@ -681,7 +681,7 @@ public class SecondaryIndexTest extends CQLTester
         // the indexed value passes validation, but the batch size will
         // exceed the default failure threshold, so temporarily raise it
         // (the non-conditional batch doesn't hit this because
-        // BatchStatement::executeInternal skips the size check but CAS
+        // BatchStatement::executeLocally skips the size check but CAS
         // path does not)
         long batchSizeThreshold = 
DatabaseDescriptor.getBatchSizeFailThreshold();
         try
@@ -734,7 +734,7 @@ public class SecondaryIndexTest extends CQLTester
         // the indexed value passes validation, but the batch size will
         // exceed the default failure threshold, so temporarily raise it
         // (the non-conditional batch doesn't hit this because
-        // BatchStatement::executeInternal skips the size check but CAS
+        // BatchStatement::executeLocally skips the size check but CAS
         // path does not)
         long batchSizeThreshold = 
DatabaseDescriptor.getBatchSizeFailThreshold();
         try
@@ -771,15 +771,15 @@ public class SecondaryIndexTest extends CQLTester
     public void prepareStatementsWithLIKEClauses() throws Throwable
     {
         createTable("CREATE TABLE %s (a int, c1 text, c2 text, v1 text, v2 
text, v3 int, PRIMARY KEY (a, c1, c2))");
-        createIndex(String.format("CREATE CUSTOM INDEX c1_idx on %%s(c1) USING 
'%s' WITH OPTIONS = {'mode' : 'PREFIX'}",
-                                  SASIIndex.class.getName()));
-        createIndex(String.format("CREATE CUSTOM INDEX c2_idx on %%s(c2) USING 
'%s' WITH OPTIONS = {'mode' : 'CONTAINS'}",
-                                  SASIIndex.class.getName()));
-        createIndex(String.format("CREATE CUSTOM INDEX v1_idx on %%s(v1) USING 
'%s' WITH OPTIONS = {'mode' : 'PREFIX'}",
-                                  SASIIndex.class.getName()));
-        createIndex(String.format("CREATE CUSTOM INDEX v2_idx on %%s(v2) USING 
'%s' WITH OPTIONS = {'mode' : 'CONTAINS'}",
-                                  SASIIndex.class.getName()));
-        createIndex(String.format("CREATE CUSTOM INDEX v3_idx on %%s(v3) USING 
'%s'", SASIIndex.class.getName()));
+        createIndex(format("CREATE CUSTOM INDEX c1_idx on %%s(c1) USING '%s' 
WITH OPTIONS = {'mode' : 'PREFIX'}",
+                           SASIIndex.class.getName()));
+        createIndex(format("CREATE CUSTOM INDEX c2_idx on %%s(c2) USING '%s' 
WITH OPTIONS = {'mode' : 'CONTAINS'}",
+                           SASIIndex.class.getName()));
+        createIndex(format("CREATE CUSTOM INDEX v1_idx on %%s(v1) USING '%s' 
WITH OPTIONS = {'mode' : 'PREFIX'}",
+                           SASIIndex.class.getName()));
+        createIndex(format("CREATE CUSTOM INDEX v2_idx on %%s(v2) USING '%s' 
WITH OPTIONS = {'mode' : 'CONTAINS'}",
+                           SASIIndex.class.getName()));
+        createIndex(format("CREATE CUSTOM INDEX v3_idx on %%s(v3) USING '%s'", 
SASIIndex.class.getName()));
 
         forcePreparedValues();
         // prefix mode indexes support prefix/contains/matches
@@ -903,8 +903,8 @@ public class SecondaryIndexTest extends CQLTester
         String indexClassName = StubIndex.class.getName();
         createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY ((a), 
b))");
         // uses different options otherwise the two indexes are considered 
duplicates
-        createIndex(String.format("CREATE CUSTOM INDEX c_idx_1 ON %%s(c) USING 
'%s' WITH OPTIONS = {'foo':'a'}", indexClassName));
-        createIndex(String.format("CREATE CUSTOM INDEX c_idx_2 ON %%s(c) USING 
'%s' WITH OPTIONS = {'foo':'b'}", indexClassName));
+        createIndex(format("CREATE CUSTOM INDEX c_idx_1 ON %%s(c) USING '%s' 
WITH OPTIONS = {'foo':'a'}", indexClassName));
+        createIndex(format("CREATE CUSTOM INDEX c_idx_2 ON %%s(c) USING '%s' 
WITH OPTIONS = {'foo':'b'}", indexClassName));
 
         ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
         TableMetadata cfm = cfs.metadata();
@@ -946,7 +946,7 @@ public class SecondaryIndexTest extends CQLTester
 
         String indexClassName = StubIndex.class.getName();
         createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY ((a), 
b))");
-        createIndex(String.format("CREATE CUSTOM INDEX c_idx ON %%s(c) USING 
'%s'", indexClassName));
+        createIndex(format("CREATE CUSTOM INDEX c_idx ON %%s(c) USING '%s'", 
indexClassName));
 
         ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
         TableMetadata cfm = cfs.metadata();
@@ -1002,7 +1002,7 @@ public class SecondaryIndexTest extends CQLTester
         // Any columns which are unchanged by the update are not passed to the 
Indexer
         // Note that for simplicity this test resets the index between each 
scenario
         createTable("CREATE TABLE %s (k int, c int, v1 int, v2 int, PRIMARY 
KEY (k,c))");
-        createIndex(String.format("CREATE CUSTOM INDEX test_index ON %%s() 
USING '%s'", StubIndex.class.getName()));
+        createIndex(format("CREATE CUSTOM INDEX test_index ON %%s() USING 
'%s'", StubIndex.class.getName()));
         execute("INSERT INTO %s (k, c, v1, v2) VALUES (0, 0, 0, 0) USING 
TIMESTAMP 0");
 
         ColumnMetadata v1 = 
getCurrentColumnFamilyStore().metadata().getColumn(new ColumnIdentifier("v1", 
true));
@@ -1440,8 +1440,8 @@ public class SecondaryIndexTest extends CQLTester
         assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, 
udt1));
 
         dropIndex("DROP INDEX %s." + indexName);
-        assertInvalidMessage(String.format("Index '%s' could not be found", 
indexName),
-                             String.format("DROP INDEX %s.%s", KEYSPACE, 
indexName));
+        assertInvalidMessage(format("Index '%s.%s' doesn't exist", KEYSPACE, 
indexName),
+                             format("DROP INDEX %s.%s", KEYSPACE, indexName));
         
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
                              "SELECT * FROM %s WHERE v = ?", udt1);
     }
@@ -1473,8 +1473,8 @@ public class SecondaryIndexTest extends CQLTester
         assertEmpty(execute("SELECT * FROM %s WHERE v = ?", set(udt2)));
 
         dropIndex("DROP INDEX %s." + indexName);
-        assertInvalidMessage(String.format("Index '%s' could not be found", 
indexName),
-                             String.format("DROP INDEX %s.%s", KEYSPACE, 
indexName));
+        assertInvalidMessage(format("Index '%s.%s' doesn't exist", KEYSPACE, 
indexName),
+                             format("DROP INDEX %s.%s", KEYSPACE, indexName));
         
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
                              "SELECT * FROM %s WHERE v CONTAINS ?", udt1);
     }
@@ -1507,8 +1507,8 @@ public class SecondaryIndexTest extends CQLTester
         assertRows(execute("SELECT * FROM %s WHERE v CONTAINS ?", udt2), 
row(2, set(udt2)));
 
         dropIndex("DROP INDEX %s." + indexName);
-        assertInvalidMessage(String.format("Index '%s' could not be found", 
indexName),
-                             String.format("DROP INDEX %s.%s", KEYSPACE, 
indexName));
+        assertInvalidMessage(format("Index '%s.%s' doesn't exist", KEYSPACE, 
indexName),
+                             format("DROP INDEX %s.%s", KEYSPACE, indexName));
         
assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
                              "SELECT * FROM %s WHERE v CONTAINS ?", udt1);
     }
@@ -1518,9 +1518,9 @@ public class SecondaryIndexTest extends CQLTester
     {
         String type = createType("CREATE TYPE %s (a int)");
         createTable("CREATE TABLE %s (k int PRIMARY KEY, v " + type + ")");
-        assertInvalidMessage("Secondary indexes are not supported on 
non-frozen UDTs", "CREATE INDEX ON %s (v)");
-        assertInvalidMessage("Non-collection columns support only simple 
indexes", "CREATE INDEX ON %s (keys(v))");
-        assertInvalidMessage("Non-collection columns support only simple 
indexes", "CREATE INDEX ON %s (values(v))");
+        assertInvalidMessage("Cannot create index on non-frozen UDT column v", 
"CREATE INDEX ON %s (v)");
+        assertInvalidMessage("Cannot create keys() index on v. Non-collection 
columns only support simple indexes", "CREATE INDEX ON %s (keys(v))");
+        assertInvalidMessage("Cannot create values() index on v. 
Non-collection columns only support simple indexes", "CREATE INDEX ON %s 
(values(v))");
         assertInvalidMessage("full() indexes can only be created on frozen 
collections", "CREATE INDEX ON %s (full(v))");
     }
 
@@ -1568,7 +1568,7 @@ public class SecondaryIndexTest extends CQLTester
 
     private ResultMessage.Prepared prepareStatement(String cql)
     {
-        return QueryProcessor.prepare(String.format(cql, KEYSPACE, 
currentTable()),
+        return QueryProcessor.prepare(format(cql, KEYSPACE, currentTable()),
                                       ClientState.forInternalCalls());
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/TypeTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/TypeTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/entities/TypeTest.java
index bb43d75..ceb96b6 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/TypeTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/TypeTest.java
@@ -28,8 +28,8 @@ public class TypeTest extends CQLTester
     @Test
     public void testNonExistingOnes() throws Throwable
     {
-        assertInvalidMessage("No user type named", "DROP TYPE " + KEYSPACE + 
".type_does_not_exist");
-        assertInvalidMessage("Cannot drop type in unknown keyspace", "DROP 
TYPE keyspace_does_not_exist.type_does_not_exist");
+        assertInvalidMessage(String.format("Type '%s.type_does_not_exist' 
doesn't exist", KEYSPACE), "DROP TYPE " + KEYSPACE + ".type_does_not_exist");
+        assertInvalidMessage("Type 
'keyspace_does_not_exist.type_does_not_exist' doesn't exist", "DROP TYPE 
keyspace_does_not_exist.type_does_not_exist");
 
         execute("DROP TYPE IF EXISTS " + KEYSPACE + ".type_does_not_exist");
         execute("DROP TYPE IF EXISTS 
keyspace_does_not_exist.type_does_not_exist");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/UFAuthTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/UFAuthTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/entities/UFAuthTest.java
index ecff0cc..4a2d71f 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/UFAuthTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UFAuthTest.java
@@ -226,7 +226,7 @@ public class UFAuthTest extends CQLTester
             functions.add(functionName);
             statements.add(stmt);
         }
-        BatchStatement batch = new BatchStatement(-1, 
BatchStatement.Type.LOGGED, statements, Attributes.none());
+        BatchStatement batch = new BatchStatement(BatchStatement.Type.LOGGED, 
VariableSpecifications.empty(), statements, Attributes.none());
         assertUnauthorized(batch, functions);
 
         grantExecuteOnFunction(functions.get(0));
@@ -236,7 +236,7 @@ public class UFAuthTest extends CQLTester
         assertUnauthorized(batch, functions.subList(2, functions.size()));
 
         grantExecuteOnFunction(functions.get(2));
-        batch.checkAccess(clientState);
+        batch.authorize(clientState);
     }
 
     @Test
@@ -313,7 +313,7 @@ public class UFAuthTest extends CQLTester
         // with terminal arguments, so evaluated at prepare time
         String cql = String.format("UPDATE %s SET v2 = 0 WHERE k = 
blobasint(intasblob(0)) and v1 = 0",
                                    KEYSPACE + "." + currentTable());
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
 
         // with non-terminal arguments, so evaluated at execution
         String functionName = createSimpleFunction();
@@ -321,7 +321,7 @@ public class UFAuthTest extends CQLTester
         cql = String.format("UPDATE %s SET v2 = 0 WHERE k = 
blobasint(intasblob(%s)) and v1 = 0",
                             KEYSPACE + "." + currentTable(),
                             functionCall(functionName));
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
     }
 
     @Test
@@ -343,7 +343,7 @@ public class UFAuthTest extends CQLTester
         assertUnauthorized(aggDef, fFunc, "int");
         grantExecuteOnFunction(fFunc);
 
-        getStatement(aggDef).checkAccess(clientState);
+        getStatement(aggDef).authorize(clientState);
     }
 
     @Test
@@ -361,24 +361,24 @@ public class UFAuthTest extends CQLTester
         String cql = String.format("SELECT %s(v1) FROM %s",
                                    aggregate,
                                    KEYSPACE + "." + currentTable());
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
 
         // check that revoking EXECUTE permission on any one of the
         // component functions means we lose the ability to execute it
         revokeExecuteOnFunction(aggregate);
         assertUnauthorized(cql, aggregate, "int");
         grantExecuteOnFunction(aggregate);
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
 
         revokeExecuteOnFunction(sFunc);
         assertUnauthorized(cql, sFunc, "int, int");
         grantExecuteOnFunction(sFunc);
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
 
         revokeExecuteOnFunction(fFunc);
         assertUnauthorized(cql, fFunc, "int");
         grantExecuteOnFunction(fFunc);
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
     }
 
     @Test
@@ -410,7 +410,7 @@ public class UFAuthTest extends CQLTester
         assertUnauthorized(cql, aggregate, "int");
         grantExecuteOnFunction(aggregate);
 
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
     }
 
     @Test
@@ -442,7 +442,7 @@ public class UFAuthTest extends CQLTester
         assertUnauthorized(cql, innerFunc, "int");
         grantExecuteOnFunction(innerFunc);
 
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
     }
 
     @Test
@@ -484,7 +484,7 @@ public class UFAuthTest extends CQLTester
         grantExecuteOnFunction(innerFunction);
 
         // now execution of both is permitted
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
     }
 
     private void assertPermissionsOnFunction(String cql, String functionName) 
throws Throwable
@@ -496,14 +496,14 @@ public class UFAuthTest extends CQLTester
     {
         assertUnauthorized(cql, functionName, argTypes);
         grantExecuteOnFunction(functionName);
-        getStatement(cql).checkAccess(clientState);
+        getStatement(cql).authorize(clientState);
     }
 
     private void assertUnauthorized(BatchStatement batch, Iterable<String> 
functionNames) throws Throwable
     {
         try
         {
-            batch.checkAccess(clientState);
+            batch.authorize(clientState);
             fail("Expected an UnauthorizedException, but none was thrown");
         }
         catch (UnauthorizedException e)
@@ -520,7 +520,7 @@ public class UFAuthTest extends CQLTester
     {
         try
         {
-            getStatement(cql).checkAccess(clientState);
+            getStatement(cql).authorize(clientState);
             fail("Expected an UnauthorizedException, but none was thrown");
         }
         catch (UnauthorizedException e)
@@ -625,7 +625,7 @@ public class UFAuthTest extends CQLTester
 
     private CQLStatement getStatement(String cql)
     {
-        return QueryProcessor.getStatement(cql, clientState).statement;
+        return QueryProcessor.getStatement(cql, clientState);
     }
 
     private FunctionResource functionResource(String functionName)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/UFIdentificationTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/UFIdentificationTest.java
 
b/test/unit/org/apache/cassandra/cql3/validation/entities/UFIdentificationTest.java
index b2288e4..bba5c92 100644
--- 
a/test/unit/org/apache/cassandra/cql3/validation/entities/UFIdentificationTest.java
+++ 
b/test/unit/org/apache/cassandra/cql3/validation/entities/UFIdentificationTest.java
@@ -28,6 +28,7 @@ import org.junit.Test;
 import org.apache.cassandra.cql3.Attributes;
 import org.apache.cassandra.cql3.CQLStatement;
 import org.apache.cassandra.cql3.QueryProcessor;
+import org.apache.cassandra.cql3.VariableSpecifications;
 import org.apache.cassandra.cql3.functions.Function;
 import org.apache.cassandra.cql3.statements.BatchStatement;
 import org.apache.cassandra.cql3.statements.ModificationStatement;
@@ -307,7 +308,7 @@ public class UFIdentificationTest extends CQLTester
         statements.add(modificationStatement(cql("INSERT INTO %s (key, i_cc, 
t_cc) VALUES (2, 2, %s)",
                                                  functionCall(tFunc, 
"'foo'"))));
 
-        BatchStatement batch = new BatchStatement(-1, 
BatchStatement.Type.LOGGED, statements, Attributes.none());
+        BatchStatement batch = new BatchStatement(BatchStatement.Type.LOGGED, 
VariableSpecifications.empty(), statements, Attributes.none());
         assertFunctions(batch, iFunc, iFunc2, tFunc);
     }
 
@@ -320,18 +321,18 @@ public class UFIdentificationTest extends CQLTester
         statements.add(modificationStatement(cql("UPDATE %s SET i_val = %s 
WHERE key=0 AND i_cc=1 and t_cc='foo' IF s_val = %s",
                                                  functionCall(iFunc, "0"), 
functionCall(sFunc, "{1}"))));
 
-        BatchStatement batch = new BatchStatement(-1, 
BatchStatement.Type.LOGGED, statements, Attributes.none());
+        BatchStatement batch = new BatchStatement(BatchStatement.Type.LOGGED, 
VariableSpecifications.empty(), statements, Attributes.none());
         assertFunctions(batch, iFunc, lFunc, sFunc);
     }
 
     private ModificationStatement modificationStatement(String cql)
     {
-        return (ModificationStatement) QueryProcessor.getStatement(cql, 
ClientState.forInternalCalls()).statement;
+        return (ModificationStatement) QueryProcessor.getStatement(cql, 
ClientState.forInternalCalls());
     }
 
     private void assertFunctions(String cql, String... function)
     {
-        CQLStatement stmt = QueryProcessor.getStatement(cql, 
ClientState.forInternalCalls()).statement;
+        CQLStatement stmt = QueryProcessor.getStatement(cql, 
ClientState.forInternalCalls());
         assertFunctions(stmt, function);
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/UFTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/UFTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/entities/UFTest.java
index 7940b92..7071e25 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/UFTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UFTest.java
@@ -58,10 +58,21 @@ public class UFTest extends CQLTester
     @Test
     public void testNonExistingOnes() throws Throwable
     {
-        assertInvalidThrowMessage("Cannot drop non existing function", 
InvalidRequestException.class, "DROP FUNCTION " + KEYSPACE + 
".func_does_not_exist");
-        assertInvalidThrowMessage("Cannot drop non existing function", 
InvalidRequestException.class, "DROP FUNCTION " + KEYSPACE + 
".func_does_not_exist(int,text)");
-        assertInvalidThrowMessage("Cannot drop non existing function", 
InvalidRequestException.class, "DROP FUNCTION 
keyspace_does_not_exist.func_does_not_exist");
-        assertInvalidThrowMessage("Cannot drop non existing function", 
InvalidRequestException.class, "DROP FUNCTION 
keyspace_does_not_exist.func_does_not_exist(int,text)");
+        assertInvalidThrowMessage(String.format("Function 
'%s.func_does_not_exist' doesn't exist", KEYSPACE),
+                                  InvalidRequestException.class,
+                                  "DROP FUNCTION " + KEYSPACE + 
".func_does_not_exist");
+
+        assertInvalidThrowMessage(String.format("Function 
'%s.func_does_not_exist(int, text)' doesn't exist", KEYSPACE),
+                                  InvalidRequestException.class,
+                                  "DROP FUNCTION " + KEYSPACE + 
".func_does_not_exist(int, text)");
+
+        assertInvalidThrowMessage("Function 
'keyspace_does_not_exist.func_does_not_exist' doesn't exist",
+                                  InvalidRequestException.class,
+                                  "DROP FUNCTION 
keyspace_does_not_exist.func_does_not_exist");
+
+        assertInvalidThrowMessage("Function 
'keyspace_does_not_exist.func_does_not_exist(int, text)' doesn't exist",
+                                  InvalidRequestException.class,
+                                  "DROP FUNCTION 
keyspace_does_not_exist.func_does_not_exist(int, text)");
 
         execute("DROP FUNCTION IF EXISTS " + KEYSPACE + 
".func_does_not_exist");
         execute("DROP FUNCTION IF EXISTS " + KEYSPACE + 
".func_does_not_exist(int,text)");
@@ -402,13 +413,13 @@ public class UFTest extends CQLTester
         execute("DROP FUNCTION " + fSin2);
 
         // Drop unexisting function
-        assertInvalidMessage("Cannot drop non existing function", "DROP 
FUNCTION " + fSin);
+        assertInvalidMessage(String.format("Function '%s' doesn't exist", 
fSin), "DROP FUNCTION " + fSin);
         // but don't complain with "IF EXISTS"
         execute("DROP FUNCTION IF EXISTS " + fSin);
 
         // can't drop native functions
-        assertInvalidMessage("system keyspace is not user-modifiable", "DROP 
FUNCTION totimestamp");
-        assertInvalidMessage("system keyspace is not user-modifiable", "DROP 
FUNCTION uuid");
+        assertInvalidMessage("System keyspace 'system' is not 
user-modifiable", "DROP FUNCTION totimestamp");
+        assertInvalidMessage("System keyspace 'system' is not 
user-modifiable", "DROP FUNCTION uuid");
 
         // sin() no longer exists
         assertInvalidMessage("Unknown function", "SELECT key, sin(d) FROM %s");
@@ -509,8 +520,8 @@ public class UFTest extends CQLTester
         assertEmpty(execute("SELECT v FROM %s WHERE k = " + fOverload + 
"((varchar)?)", "foo"));
 
         // no such functions exist...
-        assertInvalidMessage("non existing function", "DROP FUNCTION " + 
fOverload + "(boolean)");
-        assertInvalidMessage("non existing function", "DROP FUNCTION " + 
fOverload + "(bigint)");
+        assertInvalidMessage(String.format("Function '%s(boolean)' doesn't 
exist", fOverload), "DROP FUNCTION " + fOverload + "(boolean)");
+        assertInvalidMessage(String.format("Function '%s(bigint)' doesn't 
exist", fOverload), "DROP FUNCTION " + fOverload + "(bigint)");
 
         // 'overloaded' has multiple overloads - so it has to fail 
(CASSANDRA-7812)
         assertInvalidMessage("matches multiple function definitions", "DROP 
FUNCTION " + fOverload);
@@ -654,10 +665,10 @@ public class UFTest extends CQLTester
                              "LANGUAGE JAVA\n" +
 
                              "AS 'return null;';");
-        assertInvalidMessage("system keyspace is not user-modifiable",
+        assertInvalidMessage("System keyspace 'system' is not user-modifiable",
                              "DROP FUNCTION system.now");
 
-        // KS for executeInternal() is system
+        // KS for executeLocally() is system
         assertInvalidMessage("system keyspace is not user-modifiable",
                              "CREATE OR REPLACE FUNCTION jnft(val double) " +
                              "RETURNS NULL ON NULL INPUT " +
@@ -670,7 +681,7 @@ public class UFTest extends CQLTester
                              "RETURNS timestamp " +
                              "LANGUAGE JAVA\n" +
                              "AS 'return null;';");
-        assertInvalidMessage("system keyspace is not user-modifiable",
+        assertInvalidMessage("System keyspace 'system' is not user-modifiable",
                              "DROP FUNCTION now");
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/UFTypesTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/UFTypesTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/entities/UFTypesTest.java
index 3f1bcb1..7180405 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/UFTypesTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UFTypesTest.java
@@ -331,7 +331,7 @@ public class UFTypesTest extends CQLTester
         assertRows(execute("SELECT a FROM %s WHERE b = " + functionName + 
"(?)", set(1, 2, 3)),
                    row(1));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("Argument 'frozen<set<int>>' cannot be frozen; 
remove frozen<> modifier from 'frozen<set<int>>'",
                              "DROP FUNCTION " + functionName + 
"(frozen<set<int>>);");
     }
 
@@ -384,7 +384,7 @@ public class UFTypesTest extends CQLTester
         assertRows(execute("SELECT a FROM %s WHERE b = " + functionName + 
"(?)", set(1, 2, 3)),
                    row(1));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("frozen<list<int>>' cannot be frozen; remove 
frozen<> modifier from 'frozen<list<int>>'",
                              "DROP FUNCTION " + functionName + 
"(frozen<list<int>>);");
     }
 
@@ -437,7 +437,7 @@ public class UFTypesTest extends CQLTester
         assertRows(execute("SELECT a FROM %s WHERE b = " + functionName + 
"(?)", map(1, 1, 2, 2, 3, 3)),
                    row(1));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("frozen<map<int, int>>' cannot be frozen; remove 
frozen<> modifier from 'frozen<map<int, int>>",
                              "DROP FUNCTION " + functionName + 
"(frozen<map<int, int>>);");
     }
 
@@ -490,7 +490,7 @@ public class UFTypesTest extends CQLTester
         assertRows(execute("SELECT a FROM %s WHERE b = " + functionName + 
"(?)", tuple(1, 2)),
                    row(1));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("Argument 'tuple<int, int>' cannot be frozen; 
remove frozen<> modifier from 'tuple<int, int>'",
                              "DROP FUNCTION " + functionName + 
"(frozen<tuple<int, int>>);");
     }
 
@@ -544,7 +544,7 @@ public class UFTypesTest extends CQLTester
         assertRows(execute("SELECT a FROM %s WHERE b = " + functionName + 
"({f: ?})", 1),
                    row(1));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage(String.format("frozen<%s>' cannot be frozen; 
remove frozen<> modifier from 'frozen<%s>'", myType, myType),
                              "DROP FUNCTION " + functionName + "(frozen<" + 
myType + ">);");
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
index e295d82..6931078 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
@@ -100,9 +100,9 @@ public class UserTypesTest extends CQLTester
         String myType = KEYSPACE + '.' + typename;
 
         // non-frozen UDTs in a table PK
-        assertInvalidMessage("Invalid non-frozen user-defined type for PRIMARY 
KEY component k",
+        assertInvalidMessage("Invalid non-frozen user-defined type \"" + 
myType + "\" for PRIMARY KEY column 'k'",
                 "CREATE TABLE " + KEYSPACE + ".wrong (k " + myType + " PRIMARY 
KEY , v int)");
-        assertInvalidMessage("Invalid non-frozen user-defined type for PRIMARY 
KEY component k2",
+        assertInvalidMessage("Invalid non-frozen user-defined type \"" + 
myType + "\" for PRIMARY KEY column 'k2'",
                 "CREATE TABLE " + KEYSPACE + ".wrong (k1 int, k2 " + myType + 
", v int, PRIMARY KEY (k1, k2))");
 
         // non-frozen UDTs in a collection
@@ -611,7 +611,7 @@ public class UserTypesTest extends CQLTester
     private void assertInvalidAlterDropStatements(String t) throws Throwable
     {
         assertInvalidMessage("Cannot alter user type " + typeWithKs(t), "ALTER 
TYPE " + typeWithKs(t) + " RENAME foo TO bar;");
-        assertInvalidMessage("Cannot drop user type " + typeWithKs(t), "DROP 
TYPE " + typeWithKs(t) + ';');
+        assertInvalidMessage("Cannot drop user type '" + typeWithKs(t), "DROP 
TYPE " + typeWithKs(t) + ';');
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
 
b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
index a1e9c8f..5489e4d 100644
--- 
a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
+++ 
b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
@@ -68,10 +68,21 @@ public class AggregationTest extends CQLTester
     @Test
     public void testNonExistingOnes() throws Throwable
     {
-        assertInvalidThrowMessage("Cannot drop non existing aggregate", 
InvalidRequestException.class, "DROP AGGREGATE " + KEYSPACE + 
".aggr_does_not_exist");
-        assertInvalidThrowMessage("Cannot drop non existing aggregate", 
InvalidRequestException.class, "DROP AGGREGATE " + KEYSPACE + 
".aggr_does_not_exist(int,text)");
-        assertInvalidThrowMessage("Cannot drop non existing aggregate", 
InvalidRequestException.class, "DROP AGGREGATE 
keyspace_does_not_exist.aggr_does_not_exist");
-        assertInvalidThrowMessage("Cannot drop non existing aggregate", 
InvalidRequestException.class, "DROP AGGREGATE 
keyspace_does_not_exist.aggr_does_not_exist(int,text)");
+        assertInvalidThrowMessage(String.format("Aggregate 
'%s.aggr_does_not_exist' doesn't exist", KEYSPACE),
+                                  InvalidRequestException.class,
+                                  "DROP AGGREGATE " + KEYSPACE + 
".aggr_does_not_exist");
+
+        assertInvalidThrowMessage(String.format("Aggregate 
'%s.aggr_does_not_exist(int, text)' doesn't exist", KEYSPACE),
+                                  InvalidRequestException.class,
+                                  "DROP AGGREGATE " + KEYSPACE + 
".aggr_does_not_exist(int,text)");
+
+        assertInvalidThrowMessage("Aggregate 
'keyspace_does_not_exist.aggr_does_not_exist' doesn't exist",
+                                  InvalidRequestException.class,
+                                  "DROP AGGREGATE 
keyspace_does_not_exist.aggr_does_not_exist");
+
+        assertInvalidThrowMessage("Aggregate 
'keyspace_does_not_exist.aggr_does_not_exist(int, text)' doesn't exist",
+                                  InvalidRequestException.class,
+                                  "DROP AGGREGATE 
keyspace_does_not_exist.aggr_does_not_exist(int,text)");
 
         execute("DROP AGGREGATE IF EXISTS " + KEYSPACE + 
".aggr_does_not_exist");
         execute("DROP AGGREGATE IF EXISTS " + KEYSPACE + 
".aggr_does_not_exist(int,text)");
@@ -482,7 +493,7 @@ public class AggregationTest extends CQLTester
 
         // DROP AGGREGATE must not succeed against a scalar
         assertInvalidMessage("matches multiple function definitions", "DROP 
AGGREGATE " + f);
-        assertInvalidMessage("non existing", "DROP AGGREGATE " + f + "(double, 
double)");
+        assertInvalidMessage("doesn't exist", "DROP AGGREGATE " + f + 
"(double, double)");
 
         String a = createAggregate(KEYSPACE,
                                    "double",
@@ -499,7 +510,7 @@ public class AggregationTest extends CQLTester
 
         // DROP FUNCTION must not succeed against an aggregate
         assertInvalidMessage("matches multiple function definitions", "DROP 
FUNCTION " + a);
-        assertInvalidMessage("non existing function", "DROP FUNCTION " + a + 
"(double)");
+        assertInvalidMessage("doesn't exist", "DROP FUNCTION " + a + 
"(double)");
 
         // ambigious
         assertInvalidMessage("matches multiple function definitions", "DROP 
AGGREGATE " + a);
@@ -1309,41 +1320,6 @@ public class AggregationTest extends CQLTester
     }
 
     @Test
-    public void testBrokenAggregate() throws Throwable
-    {
-        createTable("CREATE TABLE %s (key int primary key, val int)");
-        execute("INSERT INTO %s (key, val) VALUES (?, ?)", 1, 1);
-
-        String fState = createFunction(KEYSPACE,
-                                       "int, int",
-                                       "CREATE FUNCTION %s(a int, b int) " +
-                                       "CALLED ON NULL INPUT " +
-                                       "RETURNS int " +
-                                       "LANGUAGE javascript " +
-                                       "AS 'a + b;'");
-
-        String a = createAggregate(KEYSPACE,
-                                   "int",
-                                   "CREATE AGGREGATE %s(int) " +
-                                   "SFUNC " + shortFunctionName(fState) + " " +
-                                   "STYPE int ");
-
-        KeyspaceMetadata ksm = Schema.instance.getKeyspaceMetadata(keyspace());
-        UDAggregate f = (UDAggregate) 
ksm.functions.get(parseFunctionName(a)).iterator().next();
-
-        UDAggregate broken = UDAggregate.createBroken(f.name(),
-                                                      f.argTypes(),
-                                                      f.returnType(),
-                                                      null,
-                                                      new 
InvalidRequestException("foo bar is broken"));
-
-        Schema.instance.load(ksm.withSwapped(ksm.functions.without(f.name(), 
f.argTypes()).with(broken)));
-
-        assertInvalidThrowMessage("foo bar is broken", 
InvalidRequestException.class,
-                                  "SELECT " + a + "(val) FROM %s");
-    }
-
-    @Test
     public void testWrongStateType() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val int)");
@@ -1489,7 +1465,7 @@ public class AggregationTest extends CQLTester
         assertRows(execute("SELECT " + aggregation + "(b) FROM %s"),
                    row(set(7, 8, 9)));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("Argument 'frozen<set<int>>' cannot be frozen; 
remove frozen<> modifier from 'frozen<set<int>>'",
                              "DROP AGGREGATE %s (frozen<set<int>>);");
     }
 
@@ -1538,7 +1514,7 @@ public class AggregationTest extends CQLTester
         assertRows(execute("SELECT " + aggregation + "(b) FROM %s"),
                    row(list(7, 8, 9)));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("Argument 'frozen<list<int>>' cannot be frozen; 
remove frozen<> modifier from 'frozen<list<int>>'",
                              "DROP AGGREGATE %s (frozen<list<int>>);");
     }
 
@@ -1587,7 +1563,7 @@ public class AggregationTest extends CQLTester
         assertRows(execute("SELECT " + aggregation + "(b) FROM %s"),
                    row(map(7, 8, 9, 10)));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("Argument 'frozen<map<int, int>>' cannot be 
frozen; remove frozen<> modifier from 'frozen<map<int, int>>'",
                              "DROP AGGREGATE %s (frozen<map<int, int>>);");
     }
 
@@ -1636,7 +1612,7 @@ public class AggregationTest extends CQLTester
         assertRows(execute("SELECT " + aggregation + "(b) FROM %s"),
                    row(tuple(7, 8)));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage("Argument 'tuple<int, int>' cannot be frozen; 
remove frozen<> modifier from 'tuple<int, int>'",
                              "DROP AGGREGATE %s (frozen<tuple<int, int>>);");
     }
 
@@ -1686,7 +1662,7 @@ public class AggregationTest extends CQLTester
         assertRows(execute("SELECT " + aggregation + "(b).f FROM %s"),
                    row(7));
 
-        assertInvalidMessage("The function arguments should not be frozen",
+        assertInvalidMessage(String.format("Argument 'frozen<%s>' cannot be 
frozen; remove frozen<> modifier from 'frozen<%s>'", myType, myType),
                              "DROP AGGREGATE %s (frozen<" + myType + ">);");
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/operations/CreateTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/operations/CreateTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/operations/CreateTest.java
index 7eccf13..7866ea0 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/CreateTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/CreateTest.java
@@ -26,20 +26,18 @@ import java.util.UUID;
 
 import org.junit.Test;
 
-import org.apache.cassandra.schema.TableMetadata;
 import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.schema.Schema;
-import org.apache.cassandra.schema.SchemaConstants;
 import org.apache.cassandra.cql3.CQLTester;
 import org.apache.cassandra.cql3.Duration;
 import org.apache.cassandra.db.Mutation;
 import org.apache.cassandra.db.partitions.Partition;
 import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.exceptions.InvalidRequestException;
 import org.apache.cassandra.exceptions.SyntaxException;
+import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.locator.AbstractEndpointSnitch;
 import org.apache.cassandra.locator.IEndpointSnitch;
-import org.apache.cassandra.io.util.DataOutputBuffer;
-import org.apache.cassandra.schema.SchemaKeyspace;
+import org.apache.cassandra.schema.*;
 import org.apache.cassandra.triggers.ITrigger;
 import org.apache.cassandra.utils.ByteBufferUtil;
 
@@ -49,7 +47,6 @@ import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 import static junit.framework.Assert.fail;
 import static org.apache.cassandra.cql3.Duration.*;
-import static org.junit.Assert.assertEquals;
 
 public class CreateTest extends CQLTester
 {
@@ -91,14 +88,14 @@ public class CreateTest extends CQLTester
     @Test
     public void testCreateTableWithDurationColumns() throws Throwable
     {
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part a",
-                             "CREATE TABLE test (a duration PRIMARY KEY, b 
int);");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'a'",
+                             "CREATE TABLE cql_test_keyspace.table0 (a 
duration PRIMARY KEY, b int);");
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part b",
-                             "CREATE TABLE test (a text, b duration, c 
duration, primary key (a, b));");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'b'",
+                             "CREATE TABLE cql_test_keyspace.table0 (a text, b 
duration, c duration, primary key (a, b));");
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part b",
-                             "CREATE TABLE test (a text, b duration, c 
duration, primary key (a, b)) with clustering order by (b DESC);");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'b'",
+                             "CREATE TABLE cql_test_keyspace.table0 (a text, b 
duration, c duration, primary key (a, b)) with clustering order by (b DESC);");
 
         createTable("CREATE TABLE %s (a int, b int, c duration, primary key 
(a, b));");
         execute("INSERT INTO %s (a, b, c) VALUES (1, 1, 1y2mo)");
@@ -178,25 +175,25 @@ public class CreateTest extends CQLTester
 
         // Test duration within Map
         assertInvalidMessage("Durations are not allowed as map keys: 
map<duration, text>",
-                             "CREATE TABLE test(pk int PRIMARY KEY, m 
map<duration, text>)");
+                             "CREATE TABLE cql_test_keyspace.table0(pk int 
PRIMARY KEY, m map<duration, text>)");
 
         createTable("CREATE TABLE %s(pk int PRIMARY KEY, m map<text, 
duration>)");
         execute("INSERT INTO %s (pk, m) VALUES (1, {'one month' : 1mo, '60 
days' : 60d})");
         assertRows(execute("SELECT * FROM %s"),
                    row(1, map("one month", Duration.from("1mo"), "60 days", 
Duration.from("60d"))));
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part m",
-                "CREATE TABLE %s(m frozen<map<text, duration>> PRIMARY KEY, v 
int)");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'm'",
+                "CREATE TABLE cql_test_keyspace.table0(m frozen<map<text, 
duration>> PRIMARY KEY, v int)");
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part m",
-                             "CREATE TABLE %s(pk int, m frozen<map<text, 
duration>>, v int, PRIMARY KEY (pk, m))");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'm'",
+                             "CREATE TABLE cql_test_keyspace.table0(pk int, m 
frozen<map<text, duration>>, v int, PRIMARY KEY (pk, m))");
 
         // Test duration within Set
         assertInvalidMessage("Durations are not allowed inside sets: 
set<duration>",
-                             "CREATE TABLE %s(pk int PRIMARY KEY, s 
set<duration>)");
+                             "CREATE TABLE cql_test_keyspace.table0(pk int 
PRIMARY KEY, s set<duration>)");
 
         assertInvalidMessage("Durations are not allowed inside sets: 
frozen<set<duration>>",
-                             "CREATE TABLE %s(s frozen<set<duration>> PRIMARY 
KEY, v int)");
+                             "CREATE TABLE cql_test_keyspace.table0(s 
frozen<set<duration>> PRIMARY KEY, v int)");
 
         // Test duration within List
         createTable("CREATE TABLE %s(pk int PRIMARY KEY, l list<duration>)");
@@ -204,8 +201,8 @@ public class CreateTest extends CQLTester
         assertRows(execute("SELECT * FROM %s"),
                    row(1, list(Duration.from("1mo"), Duration.from("60d"))));
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part l",
-                             "CREATE TABLE %s(l frozen<list<duration>> PRIMARY 
KEY, v int)");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'l'",
+                             "CREATE TABLE cql_test_keyspace.table0(l 
frozen<list<duration>> PRIMARY KEY, v int)");
 
         // Test duration within Tuple
         createTable("CREATE TABLE %s(pk int PRIMARY KEY, t tuple<int, 
duration>)");
@@ -213,8 +210,8 @@ public class CreateTest extends CQLTester
         assertRows(execute("SELECT * FROM %s"),
                    row(1, tuple(1, Duration.from("1mo"))));
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part t",
-                             "CREATE TABLE %s(t frozen<tuple<int, duration>> 
PRIMARY KEY, v int)");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 't'",
+                             "CREATE TABLE cql_test_keyspace.table0(t 
frozen<tuple<int, duration>> PRIMARY KEY, v int)");
 
         // Test duration within UDT
         String typename = createType("CREATE TYPE %s (a duration)");
@@ -224,12 +221,12 @@ public class CreateTest extends CQLTester
         assertRows(execute("SELECT * FROM %s"),
                    row(1, userType("a", Duration.from("1mo"))));
 
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part u",
-                             "CREATE TABLE %s(pk int, u frozen<" + myType + 
">, v int, PRIMARY KEY(pk, u))");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'u'",
+                             "CREATE TABLE cql_test_keyspace.table0(pk int, u 
frozen<" + myType + ">, v int, PRIMARY KEY(pk, u))");
 
         // Test duration with several level of depth
-        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
part m",
-                "CREATE TABLE %s(pk int, m frozen<map<text, list<tuple<int, 
duration>>>>, v int, PRIMARY KEY (pk, m))");
+        assertInvalidMessage("duration type is not supported for PRIMARY KEY 
column 'm'",
+                "CREATE TABLE cql_test_keyspace.table0(pk int, m 
frozen<map<text, list<tuple<int, duration>>>>, v int, PRIMARY KEY (pk, m))");
     }
 
     private ByteBuffer duration(long months, long days, long nanoseconds) 
throws IOException
@@ -473,7 +470,7 @@ public class CreateTest extends CQLTester
     @Test
     public void testObsoleteTableProperties() throws Throwable
     {
-        assertInvalidThrow(SyntaxException.class, "CREATE TABLE test (foo text 
PRIMARY KEY, c int) WITH default_validation=timestamp");
+        assertInvalidThrow(SyntaxException.class, "CREATE TABLE 
cql_test_keyspace.table0 (foo text PRIMARY KEY, c int) WITH 
default_validation=timestamp");
 
         createTable("CREATE TABLE %s (foo text PRIMARY KEY, c int)");
         assertInvalidThrow(SyntaxException.class, "ALTER TABLE %s WITH 
default_validation=int");
@@ -494,7 +491,7 @@ public class CreateTest extends CQLTester
                      "CREATE KEYSPACE 
My_much_much_too_long_identifier_that_should_not_work WITH replication = { 
'class' : 'SimpleStrategy', 'replication_factor' : 1 }");
 
         execute("DROP KEYSPACE testXYZ");
-        assertInvalidThrow(ConfigurationException.class, "DROP KEYSPACE 
non_existing");
+        assertInvalidThrow(InvalidRequestException.class, "DROP KEYSPACE 
non_existing");
 
         execute("CREATE KEYSPACE testXYZ WITH replication = { 'class' : 
'SimpleStrategy', 'replication_factor' : 1 }");
 
@@ -557,7 +554,7 @@ public class CreateTest extends CQLTester
         String table4 = createTableName();
 
         // repeated column
-        assertInvalidMessage("Multiple definition of identifier k", 
String.format("CREATE TABLE %s (k int PRIMARY KEY, c int, k text)", table4));
+        assertInvalidMessage("Duplicate column 'k' declaration for table", 
String.format("CREATE TABLE %s (k int PRIMARY KEY, c int, k text)", table4));
 
         // compact storage limitations
         assertInvalidThrow(SyntaxException.class,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aaddbd49/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
index e5c7089..f8625a2 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java
@@ -27,8 +27,8 @@ public class DropTest extends CQLTester
     @Test
     public void testNonExistingOnes() throws Throwable
     {
-        assertInvalidMessage("Cannot drop non existing table", "DROP TABLE " + 
KEYSPACE + ".table_does_not_exist");
-        assertInvalidMessage("Cannot drop table in unknown keyspace", "DROP 
TABLE keyspace_does_not_exist.table_does_not_exist");
+        assertInvalidMessage(String.format("Table '%s.table_does_not_exist' 
doesn't exist", KEYSPACE),  "DROP TABLE " + KEYSPACE + ".table_does_not_exist");
+        assertInvalidMessage("Table 
'keyspace_does_not_exist.table_does_not_exist' doesn't exist", "DROP TABLE 
keyspace_does_not_exist.table_does_not_exist");
 
         execute("DROP TABLE IF EXISTS " + KEYSPACE + ".table_does_not_exist");
         execute("DROP TABLE IF EXISTS 
keyspace_does_not_exist.table_does_not_exist");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to