You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Paulo Motta (JIRA)" <ji...@apache.org> on 2016/05/11 01:39:12 UTC
[jira] [Commented] (CASSANDRA-10819) Generic Java UDF types
[ https://issues.apache.org/jira/browse/CASSANDRA-10819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15279358#comment-15279358 ]
Paulo Motta commented on CASSANDRA-10819:
-----------------------------------------
Is this fixed? Trying the following example from [here|http://www.doanduyhai.com/blog/?p=1876]:
{noformat}
CREATE OR REPLACE FUNCTION cumulateCounter(state map<text,bigint>, category text, count counter)
RETURNS NULL ON NULL INPUT
RETURNS map<text,bigint>
LANGUAGE java
AS '
if(state.containsKey(category)) {
state.put(category, state.get(category) + count);
} else {
state.put(category, count);
}
return state;
';
{noformat}
On trunk still gives:
{noformat}
InvalidRequest: code=2200 [Invalid query] message="Could not compile function 'bla.cumulatecounter' from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation failed:
Line 3: The operator + is undefined for the argument type(s) Object, long
Line 5: Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map<K,V> should be parameterized
Line 7: Type safety: The expression of type Map needs unchecked conversion to conform to Map<String,Long>
{noformat}
> Generic Java UDF types
> ----------------------
>
> Key: CASSANDRA-10819
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10819
> Project: Cassandra
> Issue Type: Improvement
> Components: CQL
> Reporter: Robert Stupp
> Assignee: Robert Stupp
> Priority: Minor
> Labels: UDF, doc-impacting
> Fix For: 3.4
>
>
> At the moment we only generate raw type signatures for Java UDF methods. E.g. a CQL argument type {{map<int, text>}} is just mapped to {{java.util.Map}} but could be mapped to {{java.util.Map<Integer, String>}}.
> It's a probably simple but nice improvement and feels to be a LHF.
> Depending on the complexity it might be doable for 3.0.x, too.
> Thanks for the heads-up, [~doanduyhai]!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)