[jira] [Commented] (CASSANDRA-9771) Revert CASSANDRA-9542 (allow native functions in UDA)

2015-07-09 Thread Zachary Kurey (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14620985#comment-14620985
 ] 

Zachary Kurey commented on CASSANDRA-9771:
--

This should probably be noted in CASSANDRA-9409 as well.  Since that is what 
led to CASSANDRA-9542 being filed.

 Revert CASSANDRA-9542 (allow native functions in UDA)
 -

 Key: CASSANDRA-9771
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9771
 Project: Cassandra
  Issue Type: Task
Reporter: Robert Stupp
Assignee: Robert Stupp
Priority: Blocker
 Fix For: 2.2.0


 As [noted in this 
 comment|https://issues.apache.org/jira/browse/CASSANDRA-9542?focusedCommentId=14620414page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14620414]
  of CASSANDRA-9542, we should revert it.
 Setting priority to blocker, since once 9542 gets into 2.2.0, we cannot 
 revert it.
 Will provide a patch soon.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CASSANDRA-9542) Create UDA does not recognize built-in functions without specifying system keyspace

2015-06-03 Thread Zachary Kurey (JIRA)
Zachary Kurey created CASSANDRA-9542:


 Summary: Create UDA does not recognize built-in functions without 
specifying system keyspace
 Key: CASSANDRA-9542
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9542
 Project: Cassandra
  Issue Type: Bug
Reporter: Zachary Kurey
Priority: Minor
 Fix For: 2.2.x


I'd expect when creating a UDA not to have to specify the system keyspace when 
using a built-in function for the state or final function.  For example:
{code}
CREATE AGGREGATE if not exists ks.my_agg(int) 
SFUNC ks.adder
STYPE int
FINALFUNC intasblob
;
{code}
Gives me me the error:
{quote}Final function ks.intasblob(int) does not exist or is not a scalar 
function{quote}

Prefixing with 'system.' fixes the issue. But I was expecting it to resolve as 
if I were using a built in function elsewhere.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9409) Ensure that UDF and UDAs are keyspace-isolated

2015-06-02 Thread Zachary Kurey (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14570009#comment-14570009
 ] 

Zachary Kurey commented on CASSANDRA-9409:
--

Is it expected that built in functions cannot be resolved by a UDA unless we 
specify the system keyspace?  For example:
{code}
CREATE AGGREGATE if not exists ks.my_agg(int) 
SFUNC ks.adder
STYPE int
FINALFUNC intasblob
;
{code}

Gives me me the error:
{quote}Final function ks.intasblob(int) does not exist or is not a scalar 
function{quote}  
Prefixing with 'system.' fixes the issue.  But I was expecting it to resolve as 
if I were using a built in function elsewhere.


 Ensure that UDF and UDAs are keyspace-isolated
 --

 Key: CASSANDRA-9409
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9409
 Project: Cassandra
  Issue Type: Bug
Reporter: Aleksey Yeschenko
Assignee: Robert Stupp
  Labels: qa-resolved
 Fix For: 2.2.0 rc1

 Attachments: 9409-with-system.txt, 9409.txt


 In table columns we don't allow to use UDTs from other keyspaces.
 We should also make sure that the following is *not* allowed:
 - UDFs taking UDTs from other keyspaces as arguments or return types
 - UDAs using UDFs from other keyspaces as its subfunctions
 The only exception should be made for {{system}} keyspace. UDAs and UDFs from 
 any keyspace should be able to reference and reuse those.
 Having no dependencies between keyspaces makes this consistent with the way 
 we treat UDTs, which is important, but also simplifies auth in multi-tenant 
 environments, and is also crucial to upcoming 3.X strongly consistent schema 
 work (the ability to treat keyspace as a unit of change and not having to 
 worry about cross-keyspace dependencies).
 P.S. Should *probably* still allow using other keyspaces UDFs and UDAs in 
 {{SELECT}} statements. Strict isolation in schema dependencies is what 
 matters to me here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CASSANDRA-9321) Aggregate UDFs allow SFUNC return type to differ from STYPE if FFUNC specified

2015-05-06 Thread Zachary Kurey (JIRA)
Zachary Kurey created CASSANDRA-9321:


 Summary: Aggregate UDFs allow SFUNC return type to differ from 
STYPE if FFUNC specified
 Key: CASSANDRA-9321
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9321
 Project: Cassandra
  Issue Type: Bug
  Components: Core
Reporter: Zachary Kurey
 Fix For: 3.0


When a final function is specified in an aggregate C* allows the return type of 
the state function to not match the state type.  

Allowing the mismatch if a final function is specified seems to be intentional 
as if you don't provide a final function and you provide a state function with 
a return type that doesn't match the state type, then C* gives you an error 
that states that they must match unless a final function is specified.  

It seems incorrect regardless of whether or not a final function is present to 
allow the state functions return type to vary from state type.  And indeed if 
you do so it produces an error when you try to use the aggregate.

Here is a simple example that shows the problem:
{code}
CREATE OR REPLACE FUNCTION state_func(state int, p2 int)
RETURNS double LANGUAGE java AS 'return Double.valueOf(1.0);';

CREATE OR REPLACE FUNCTION final_func(state int)
RETURNS int
LANGUAGE java
AS 'return Integer.valueOf(1);';

CREATE OR REPLACE AGGREGATE my_aggregate( int )
SFUNC state_func
STYPE int
FINALFUNC final_func
INITCOND 1;

SELECT my_aggregate(column) FROM table;
{code}

The select produces the error:
{noformat}
Aggregate 'ks.my_aggregate : (int) - int' exists but hasn't been loaded 
successfully for the following reason: Referenced state function 'ks.state_func 
[double, int]' for aggregate 'ks.my_aggregate' does not exist.
{noformat}

I was reproducing this with 3.0 trunk, though now I just grabbed the latest and 
there is an NPE instead of the error above:
{noformat}
java.lang.NullPointerException: at index 1
at 
com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:240)
 ~[guava-16.0.jar:na]
at 
com.google.common.collect.ImmutableSet.construct(ImmutableSet.java:195) 
~[guava-16.0.jar:na]
at com.google.common.collect.ImmutableSet.of(ImmutableSet.java:116) 
~[guava-16.0.jar:na]
at 
org.apache.cassandra.cql3.functions.UDAggregate.getFunctions(UDAggregate.java:110)
 ~[main/:na]
at 
org.apache.cassandra.cql3.selection.AbstractFunctionSelector$1.getFunctions(AbstractFunctionSelector.java:78)
 ~[main/:na]
at 
org.apache.cassandra.cql3.selection.SelectorFactories.getFunctions(SelectorFactories.java:105)
 ~[main/:na]
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)