cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject cassandra git commit: Don't execute any functions at prepare-time
Date Fri, 03 Apr 2015 17:53:22 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 75409a185 -> 7d68cedec


Don't execute any functions at prepare-time

Patch by Sam Tunnicliffe; reviewed by Tyler Hobbs for CASSANDRA-9037


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

Branch: refs/heads/trunk
Commit: 7d68cedecd4444537535e48074c38686ccc76f9c
Parents: 75409a1
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Fri Apr 3 12:51:24 2015 -0500
Committer: Tyler Hobbs <tyler@datastax.com>
Committed: Fri Apr 3 12:51:24 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/cql3/functions/FunctionCall.java  | 22 +-------------------
 2 files changed, 2 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7d68cede/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e8cb20b..92c09b1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0
+ * Don't execute any functions at prepare-time (CASSANDRA-9037)
  * Share file handles between all instances of a SegmentedFile (CASSANDRA-8893)
  * Make it possible to major compact LCS (CASSANDRA-7272)
  * Make FunctionExecutionException extend RequestExecutionException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7d68cede/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 90ebaaf..a3bd669 100644
--- a/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
+++ b/src/java/org/apache/cassandra/cql3/functions/FunctionCall.java
@@ -140,33 +140,13 @@ public class FunctionCall extends Term.NonTerminal
                                                                 fun, fun.argTypes().size(),
terms.size()));
 
             List<Term> parameters = new ArrayList<>(terms.size());
-            boolean allTerminal = true;
             for (int i = 0; i < terms.size(); i++)
             {
                 Term t = terms.get(i).prepare(keyspace, Functions.makeArgSpec(receiver.ksName,
receiver.cfName, scalarFun, i));
-                if (t instanceof NonTerminal)
-                    allTerminal = false;
                 parameters.add(t);
             }
 
-            // If all parameters are terminal and the function is pure, we can
-            // evaluate it now, otherwise we'd have to wait execution time
-            return allTerminal && scalarFun.isPure()
-                ? makeTerminal(scalarFun, execute(scalarFun, parameters), QueryOptions.DEFAULT.getProtocolVersion())
-                : new FunctionCall(scalarFun, parameters);
-        }
-
-        // All parameters must be terminal
-        private static ByteBuffer execute(ScalarFunction fun, List<Term> parameters)
throws InvalidRequestException
-        {
-            List<ByteBuffer> buffers = new ArrayList<>(parameters.size());
-            for (Term t : parameters)
-            {
-                assert t instanceof Term.Terminal;
-                buffers.add(((Term.Terminal)t).get(QueryOptions.DEFAULT.getProtocolVersion()));
-            }
-
-            return executeInternal(Server.CURRENT_VERSION, fun, buffers);
+            return new FunctionCall(scalarFun, parameters);
         }
 
         public AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification
receiver)


Mime
View raw message