cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Kutcharian <d...@venarc.com>
Subject Re: How to create a TupleType/TupleValue in a UDF
Date Thu, 18 Aug 2016 17:57:17 GMT
I’m running 3.0.8, so it probably wasn’t fixed? ;)
[cqlsh 5.0.1 | Cassandra 3.0.8 | CQL spec 3.4.0 | Native protocol v4]

The CodecNotFoundException is very random, when I get it, if I re-run the same exact query
then it works! I’ll see if I can reproduce it more consistently. BTW, is there a way to
get the CodecRegistry and the ProtocolVersion from the UDF environment so I don’t have to
create them?

- Drew


> On Aug 18, 2016, at 10:10 AM, Tyler Hobbs <tyler@datastax.com> wrote:
> 
> The logback-related error is due to https://issues.apache.org/jira/browse/CASSANDRA-11033
<https://issues.apache.org/jira/browse/CASSANDRA-11033>, which is fixed in 3.0.4 and
3.4.
> 
> I'm not sure about the CodecNotFoundException, can you reproduce that one reliably?
> 
> On Thu, Aug 18, 2016 at 10:52 AM, Drew Kutcharian <drew@venarc.com <mailto:drew@venarc.com>>
wrote:
> Hi All,
> 
> I have a UDF/UDA that returns a map of date -> TupleValue.
> 
> CREATE OR REPLACE FUNCTION min_max_by_timestamps_udf(state map<date, frozen<tuple<timestamp,
timestamp>>>, flake blob)
> RETURNS NULL ON NULL INPUT
> RETURNS map<date, frozen<tuple<timestamp, timestamp>>>
> LANGUAGE java
> 
> CREATE OR REPLACE AGGREGATE min_max_by_timestamps(blob)
> SFUNC min_max_by_timestamps_udf
> STYPE map<date, frozen<tuple<timestamp, timestamp>>>
> INITCOND {};
> 
> I’ve been using the following syntax to build the TupleType/TupleValue in my UDF:
> 
> TupleType tupleType = TupleType.of(com.datastax.driver.core.ProtocolVersion.NEWEST_SUPPORTED,
CodecRegistry.DEFAULT_INSTANCE, DataType.timestamp(), DataType.timestamp());
> tupleType.newValue(new java.util.Date(timestamp), new java.util.Date(timestamp)));
> 
> But “randomly" I get errors like the following:
> FunctionFailure: code=1400 [User Defined Function failure] message="execution of ’testdb.min_max_by_timestamps_udf[map<date,
frozen<tuple<timestamp, timestamp>>>, blob]' failed: java.security.AccessControlException:
access denied ("java.io.FilePermission" "/etc/cassandra/logback.xml" "read”)"
> 
> Or CodecNotFoundException for Cassandra not being able to find a codec for "map<date,
frozen<tuple<timestamp, timestamp>>>”.
> 
> Is this a bug or I’m doing something wrong?
> 
> 
> Thanks,
> 
> Drew
> 
> 
> 
> -- 
> Tyler Hobbs
> DataStax <http://datastax.com/>


Mime
View raw message