You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "FAGIM SADYKOV (JIRA)" <ji...@apache.org> on 2017/12/14 06:51:00 UTC

[jira] [Created] (CASSANDRA-14127) Cannot use UDTValue in UDF

FAGIM SADYKOV created CASSANDRA-14127:
-----------------------------------------

             Summary: Cannot use UDTValue in UDF
                 Key: CASSANDRA-14127
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14127
             Project: Cassandra
          Issue Type: Bug
          Components: CQL
            Reporter: FAGIM SADYKOV
             Fix For: 3.11.x


Try to create UDF
```
CREATE OR REPLACE FUNCTION max_x_plus_y (input set<frozen<some_record>>) CALLED ON NULL INPUT RETURNS some_record 
LANGUAGE java AS '
return Collections.max(input, new Comparator<UDTValue>() {
    @Override
    public int compare(UDTValue first, UDTValue second) {
        int firstsum = first.getInt("x")+first.getInt("y");
		int secondsum = second.getInt("x")+second.getInt("y");
       	return Integer.compare(firstsum,secondsum);
    }
});
';
```

I got error:
```
com.datastax.driver.core.exceptions.InvalidQueryException: Java source compilation failed:
GENERATED SOURCE ERROR: line 1 (in generated source): The type java.util.function.ToLongFunction cannot be resolved. It is indirectly referenced from required .class files
GENERATED SOURCE ERROR: line 1 (in generated source): The type java.util.function.ToIntFunction cannot be resolved. It is indirectly referenced from required .class files
GENERATED SOURCE ERROR: line 1 (in generated source): The type java.util.function.ToDoubleFunction cannot be resolved. It is indirectly referenced from required .class files
GENERATED SOURCE ERROR: line 1 (in generated source): The type java.util.function.Function cannot be resolved. It is indirectly referenced from required .class files
```



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org