[ 
https://issues.apache.org/jira/browse/CASSANDRA-12611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jon Haddad updated CASSANDRA-12611:
-----------------------------------
    Description: 
Now that allow filtering can be used more liberally, it would be nice to be 
able to apply a function as a predicate.  For instance, if I store a bloom 
filter on each row, it would be useful to be able to pass a value and a field 
into a function to check if the value is possibly in the set of values the 
bloom filter has seen.  For example:

{code}CREATE OR REPLACE FUNCTION inBloom (input int, field field) CALLED ON 
NULL INPUT RETURNS boolean LANGUAGE java AS 'return true;'; // pretend this 
actual evaluates correctly 
{code}

 As far as I can tell, there's no way to pass inputs to a function referencing 
a field, and no way to use the result of the function in a predicate.  The 
following simple example fails:

{code}
cqlsh:tutorials> CREATE OR REPLACE FUNCTION inBloom (input int) CALLED ON NULL 
INPUT RETURNS boolean LANGUAGE java AS 'return true;';
cqlsh:tutorials> select * from user where inBloom(1) = True;
SyntaxException: line 1:32 no viable alternative at input '(' (select * from 
user where [inBloom](...)
{code}

  was:
Now that allow filtering can be used more liberally, it would be nice to be 
able to apply a function as a predicate.  For instance, if I store a bloom 
filter on each row, it would be useful to be able to pass a value and a field 
into a function to check if the value is possibly in the set of values the 
bloom filter has seen.  For example:

    CREATE OR REPLACE FUNCTION inBloom (input int, field field) CALLED ON NULL 
INPUT RETURNS boolean LANGUAGE java AS 'return true;'; // pretend this actual 
evaluates correctly 

 As far as I can tell, there's no way to pass inputs to a function referencing 
a field, and no way to use the result of the function in a predicate.  The 
following simple example fails:

    cqlsh:tutorials> CREATE OR REPLACE FUNCTION inBloom (input int) CALLED ON 
NULL INPUT RETURNS boolean LANGUAGE java AS 'return true;';
    cqlsh:tutorials> select * from user where inBloom(1) = True;
SyntaxException: line 1:32 no viable alternative at input '(' (select * from 
user where [inBloom](...)



> Allow UDFs to be used in predicates
> -----------------------------------
>
>                 Key: CASSANDRA-12611
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12611
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Jon Haddad
>
> Now that allow filtering can be used more liberally, it would be nice to be 
> able to apply a function as a predicate.  For instance, if I store a bloom 
> filter on each row, it would be useful to be able to pass a value and a field 
> into a function to check if the value is possibly in the set of values the 
> bloom filter has seen.  For example:
> {code}CREATE OR REPLACE FUNCTION inBloom (input int, field field) CALLED ON 
> NULL INPUT RETURNS boolean LANGUAGE java AS 'return true;'; // pretend this 
> actual evaluates correctly 
> {code}
>  As far as I can tell, there's no way to pass inputs to a function 
> referencing a field, and no way to use the result of the function in a 
> predicate.  The following simple example fails:
> {code}
> cqlsh:tutorials> CREATE OR REPLACE FUNCTION inBloom (input int) CALLED ON 
> NULL INPUT RETURNS boolean LANGUAGE java AS 'return true;';
> cqlsh:tutorials> select * from user where inBloom(1) = True;
> SyntaxException: line 1:32 no viable alternative at input '(' (select * from 
> user where [inBloom](...)
> {code}



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

Reply via email to