Hello
I am trying to extract sketches (e.g. bloom filter) from some given
data. I came this far, questions below:
|CREATE TYPE bloomfilter_udt(||
n_as_sample_size int,
m_as_number_of_buckets int,||
p_as_next_prime_above_m bigint,
hash_for_string_coefficient_a list ,||
hash_for_number_coefficients_a list ,
hash_for_number_coefficients_b list ,||
bloom_filter_as_map map
);||
CREATE OR REPLACE FUNCTION bloomfilter_udf(state bloomfilter_udt, value
text, sample_size int)
CALLED ON NULL INPUT||
RETURNS bloomfilter_udt
LANGUAGE java||
AS
$$||
//put n_as_sample_size in result
//if(state.getUDTValue("n_as_sample_size") ==
null){state.setInt("n_as_sample_size", sample_size);};||
//do some more stuff to the bloomfilter_udt
return state;||
$$;
CREATE OR REPLACE AGGREGATE bloomfilter_uda(text, int)||
SFUNC bloomfilter_udf
STYPE bloomfilter_udt||
INITCOND {};|||
1) I would pass the sample_size with a sub-query, e.g.
==> "SELECT bloomfilter_uda(name, (SELECT count(*) FROM test_table))
FROM test_table;" <==
Is that possible with Cassandra?
2) When I try to register the bloomfilter_uda, I get the following error:
==> InvalidRequest: Error from server: code=2200 [Invalid query]
message="Invalid set literal for (dummy) of type bloomfilter_udt" <==
Can I just pass Cassandra data types as a state (map, list, set)?
3) If I assume, all of the above is my bad, how can I access the props
of the state? Like
==> state.n_as_sample_size <==||
Is this somehow possible?
I am kind of struggling with Cassandra and I'd appreciate some help.
Thanks
Andreas
--
andreasrimmelspac...@gmail.com