You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/09/24 15:50:14 UTC

git commit: Trunk Test fixes

Repository: cassandra
Updated Branches:
  refs/heads/trunk dffdae0c9 -> 85401dc76


Trunk Test fixes

Patch by Carl Yeksigian; reviewed by tjake for CASSANDRA-7991


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/85401dc7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/85401dc7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/85401dc7

Branch: refs/heads/trunk
Commit: 85401dc76c6e5c4d155b52d308686a5579f5d910
Parents: dffdae0
Author: Carl Yeksigian <ca...@yeksigian.com>
Authored: Mon Sep 22 14:40:29 2014 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Wed Sep 24 09:48:42 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/functions/FunctionCall.java   | 4 ++++
 test/unit/org/apache/cassandra/db/RowIndexEntryTest.java    | 9 +++++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/85401dc7/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java b/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
index d2ef90c..0a8fe58 100644
--- a/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
+++ b/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
@@ -133,6 +133,10 @@ public class FunctionCall extends Term.NonTerminal
                                                                 fun.name(), fun.returnType().asCQL3Type(),
                                                                 receiver.name, receiver.type.asCQL3Type()));
 
+            if (fun.argTypes().size() != terms.size())
+                throw new InvalidRequestException(String.format("Incorrect number of arguments specified for function %s (expected %d, found %d)",
+                                                                fun.name(), fun.argTypes().size(), terms.size()));
+
             List<Term> parameters = new ArrayList<Term>(terms.size());
             boolean allTerminal = true;
             for (int i = 0; i < terms.size(); i++)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/85401dc7/test/unit/org/apache/cassandra/db/RowIndexEntryTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RowIndexEntryTest.java b/test/unit/org/apache/cassandra/db/RowIndexEntryTest.java
index 237573e..3282b0a 100644
--- a/test/unit/org/apache/cassandra/db/RowIndexEntryTest.java
+++ b/test/unit/org/apache/cassandra/db/RowIndexEntryTest.java
@@ -18,14 +18,18 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.util.Collections;
 
 import junit.framework.Assert;
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.composites.CellNames;
 import org.apache.cassandra.db.composites.SimpleDenseCellNameType;
 import org.apache.cassandra.db.marshal.UTF8Type;
 import org.apache.cassandra.io.util.DataOutputBuffer;
+import org.apache.cassandra.locator.SimpleStrategy;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.junit.Test;
@@ -45,6 +49,11 @@ public class RowIndexEntryTest extends SchemaLoader
         Assert.assertEquals(buffer.getLength(), serializer.serializedSize(simple));
 
         buffer = new DataOutputBuffer();
+        Schema.instance.setKeyspaceDefinition(KSMetaData.newKeyspace("Keyspace1",
+                                                                     SimpleStrategy.class,
+                                                                     Collections.<String,String>emptyMap(),
+                                                                     false,
+                                                                     Collections.singleton(standardCFMD("Keyspace1", "Standard1"))));
         ColumnFamily cf = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard1");
         ColumnIndex columnIndex = new ColumnIndex.Builder(cf, ByteBufferUtil.bytes("a"), new DataOutputBuffer())
         {{