I am getting "Java compilation failed: cannot be resolved to a datatype" when trying to run the function in cassandra 3.11 version. I have compiled my class and deployed the jar in cassandra lib directory as well. Can somebody please help?Also please let me know if cassandra 3.11 is compatible to execute external JAR-based code for UDFs or not.
## package getMap;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
public class RollAgent {
public static void main(String[] args) {
// TODO Auto-generated method stub
Map<String, Integer> data = new HashMap<String, Integer>();
data.put("abcd", 2);
Map<String, Integer> returndata = RollAgent.grpagents(data);
System.out.println(returndata);
}
private static Logger LOGGER = Logger.getLogger("string");
public static Map<String, Integer> grpagents(Map<String, Integer> data) {
LOGGER.info("Steppin into agent rollups");
Map<String, Integer> map = new HashMap<>();
map.put("1", 10);
map.put("2", 20);
map.put("3", 30);
return map;
}
}
cassandra UDF:-
CREATE OR REPLACE FUNCTION
glowroot1.grpagentNtracetallydur(state map<text, int>)
CALLED ON NULL INPUT
RETURNS map<text, int>
LANGUAGE java
as 'return getMap.RollAgent.grpagents(state);';
##