Repository: cassandra
Updated Branches:
  refs/heads/trunk bc9dc0f0a -> aad152d81


Add USING to CREATE FUNCTION for CASSANDRA-7811


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

Branch: refs/heads/trunk
Commit: aad152d81c3a9fcd25222c9d9cf3e10265607906
Parents: bc9dc0f
Author: Sylvain Lebresne <sylv...@datastax.com>
Authored: Fri Aug 22 11:47:13 2014 +0200
Committer: Sylvain Lebresne <sylv...@datastax.com>
Committed: Fri Aug 22 11:47:13 2014 +0200

----------------------------------------------------------------------
 pylib/cqlshlib/cql3handling.py                  |  2 +-
 src/java/org/apache/cassandra/cql3/Cql.g        |  2 +-
 test/unit/org/apache/cassandra/cql3/UFTest.java | 32 ++++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aad152d8/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 9d1187a..5e28a9c 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -1001,7 +1001,7 @@ syntax_rules += r'''
                                   <stringLiteral>
                                 )
                               )
-                              | (<stringLiteral>)
+                              | ("USING" <stringLiteral>)
                             )
                          ;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aad152d8/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g 
b/src/java/org/apache/cassandra/cql3/Cql.g
index d44fc7c..01da5ca 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -513,7 +513,7 @@ createFunctionStatement returns [CreateFunctionStatement 
expr]
       K_RETURNS
       rt=comparatorType
       (
-          (                      { language="CLASS"; } cls = STRING_LITERAL { 
bodyOrClassName = $cls.text; } )
+          ( K_USING cls = STRING_LITERAL { bodyOrClassName = $cls.text; } )
         | ( K_LANGUAGE l = IDENT { language=$l.text; } K_AS
             (
               ( body = STRING_LITERAL

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aad152d8/test/unit/org/apache/cassandra/cql3/UFTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/UFTest.java 
b/test/unit/org/apache/cassandra/cql3/UFTest.java
index 304ee04..ec494a6 100644
--- a/test/unit/org/apache/cassandra/cql3/UFTest.java
+++ b/test/unit/org/apache/cassandra/cql3/UFTest.java
@@ -48,7 +48,7 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
 
-        execute("create function foo::cf ( input double ) returns double 
'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function foo::cf ( input double ) returns double using 
'org.apache.cassandra.cql3.UFTest#sin'");
         execute("drop function foo::cf");
     }
 
@@ -57,8 +57,8 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
 
-        execute("create function foo::cff ( input double ) returns double 
'org.apache.cassandra.cql3.UFTest#sin'");
-        execute("create function foo::cff ( input double ) returns double 
'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function foo::cff ( input double ) returns double 
using 'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function foo::cff ( input double ) returns double 
using 'org.apache.cassandra.cql3.UFTest#sin'");
     }
 
 
@@ -67,7 +67,7 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
 
-        execute("create function if not exists foo::cfine ( input double ) 
returns double 'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function if not exists foo::cfine ( input double ) 
returns double using 'org.apache.cassandra.cql3.UFTest#sin'");
         execute("drop function foo::cfine");
     }
 
@@ -76,42 +76,42 @@ public class UFTest extends CQLTester
     public void ddlCreateFunctionBadClass() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
-        execute("create function foo::cff ( input double ) returns double 
'org.apache.cassandra.cql3.DoesNotExist#doesnotexist'");
+        execute("create function foo::cff ( input double ) returns double 
using 'org.apache.cassandra.cql3.DoesNotExist#doesnotexist'");
     }
 
     @Test(expected = InvalidRequestException.class)
     public void ddlCreateFunctionBadMethod() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
-        execute("create function foo::cff ( input double ) returns double 
'org.apache.cassandra.cql3.UFTest#doesnotexist'");
+        execute("create function foo::cff ( input double ) returns double 
using 'org.apache.cassandra.cql3.UFTest#doesnotexist'");
     }
 
     @Test(expected = InvalidRequestException.class)
     public void ddlCreateFunctionBadArgType() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
-        execute("create function foo::cff ( input text ) returns double 
'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function foo::cff ( input text ) returns double using 
'org.apache.cassandra.cql3.UFTest#sin'");
     }
 
     @Test(expected = InvalidRequestException.class)
     public void ddlCreateFunctionBadReturnType() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
-        execute("create function foo::cff ( input double ) returns text 
'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function foo::cff ( input double ) returns text using 
'org.apache.cassandra.cql3.UFTest#sin'");
     }
 
     @Test(expected = InvalidRequestException.class)
     public void ddlCreateFunctionNonStaticMethod() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
-        execute("create function foo::cff ( input float ) returns float 
'org.apache.cassandra.cql3.UFTest#nonStaticMethod'");
+        execute("create function foo::cff ( input float ) returns float using 
'org.apache.cassandra.cql3.UFTest#nonStaticMethod'");
     }
 
     @Test(expected = InvalidRequestException.class)
     public void ddlCreateFunctionNonPublicMethod() throws Throwable
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
-        execute("create function foo::cff ( input float ) returns float 
'org.apache.cassandra.cql3.UFTest#privateMethod'");
+        execute("create function foo::cff ( input float ) returns float using 
'org.apache.cassandra.cql3.UFTest#privateMethod'");
     }
 
     @Test(expected = InvalidRequestException.class)
@@ -119,8 +119,8 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
 
-        execute("create function if not exists foo::cfinef ( input double ) 
returns double 'org.apache.cassandra.cql3.UFTest#sin'");
-        execute("create function if not exists foo::cfinef ( input double ) 
returns double 'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function if not exists foo::cfinef ( input double ) 
returns double using 'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function if not exists foo::cfinef ( input double ) 
returns double using 'org.apache.cassandra.cql3.UFTest#sin'");
     }
 
     @Test
@@ -128,8 +128,8 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)"); // 
not used, but required by CQLTester
 
-        execute("create function foo::corf ( input double ) returns double 
'org.apache.cassandra.cql3.UFTest#sin'");
-        execute("create or replace function foo::corf ( input double ) returns 
double 'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create function foo::corf ( input double ) returns double 
using 'org.apache.cassandra.cql3.UFTest#sin'");
+        execute("create or replace function foo::corf ( input double ) returns 
double using 'org.apache.cassandra.cql3.UFTest#sin'");
     }
 
     @Test(expected = InvalidRequestException.class)
@@ -153,7 +153,7 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)");
 
-        execute("create or replace function math::sin ( input double ) returns 
double 'org.apache.cassandra.cql3.UFTest'");
+        execute("create or replace function math::sin ( input double ) returns 
double using 'org.apache.cassandra.cql3.UFTest'");
 
         execute("INSERT INTO %s (key, val) VALUES (?, ?)", 1, 1d);
         execute("INSERT INTO %s (key, val) VALUES (?, ?)", 2, 2d);
@@ -171,7 +171,7 @@ public class UFTest extends CQLTester
     {
         createTable("CREATE TABLE %s (key int primary key, val double)");
 
-        execute("create or replace function sin ( input double ) returns 
double 'org.apache.cassandra.cql3.UFTest'");
+        execute("create or replace function sin ( input double ) returns 
double using 'org.apache.cassandra.cql3.UFTest'");
 
         execute("INSERT INTO %s (key, val) VALUES (?, ?)", 1, 1d);
         execute("INSERT INTO %s (key, val) VALUES (?, ?)", 2, 2d);

Reply via email to