Jon Haddad created CASSANDRA-12611: -------------------------------------- Summary: 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: 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](...) -- This message was sent by Atlassian JIRA (v6.3.4#6332)