无法从CQL 3.x中的用户定义函数返回地图<text,text>(Cassandra 2.2.3)

时间:2015-11-27 11:32:22

标签: cassandra cassandra-2.0 datastax cql3 datastax-java-driver

我无法从CQL 3.x(Cassandra 2.2.3)中的用户定义函数返回地图。这是我的代码:

CREATE OR REPLACE FUNCTION issaviktempkeyspace.myfilter1(begindate timestamp,argtimestamp timestamp,columnname text,columnvalue text,companyid int) 
CALLED ON NULL INPUT
RETURNS map<text,text> LANGUAGE java AS
'
if(begindate.before(argtimestamp)){
    Map<String,String> map= Collections.<String,String>emptyMap();
    map.put("columnname",columnname);
    map.put("columnvalue",columnvalue);
    map.put("companyid",Integer.toString(companyid));
    return map;
}
else
    return null;
';

当我尝试创建该功能时,Cassandra说,

InvalidQueryException: Could not compile function 'issaviktempkeyspace.myfilter1' from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation failed:
Line 3: Map cannot be resolved to a type
Line 3: Collections cannot be resolved
  com.datastax.driver.core.exceptions.InvalidQueryException: InvalidQueryException: Could not compile function 'issaviktempkeyspace.myfilter1' from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation failed:
Line 3: Map cannot be resolved to a type
Line 3: Collections cannot be resolved

- 知道如何做到这一点。 我还有一个问题。我可以将元组类型作为UDF的一部分返回吗?

0 个答案:

没有答案