Hello everybody,
I am new to Cassandra and I am trying to extract sketches (e.g. bloom filter) from some given data. While doing that, I came this far - my questions break down to the 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 <bigint>, hash_for_number_coefficients_a list <bigint>, hash_for_number_coefficients_b list <bigint>, bloom_filter_as_map map<int, int> ); CREATE OR REPLACE FUNCTION bloomfilter_udf ( state bloomfilter_udt, value text, sample_size int ) CALLED ON NULL INPUT RETURNS bloomfilter_udt LANGUAGE java AS $$ //fill state = bloomfilter_udt with some data return state; $$ ; CREATE OR REPLACE AGGREGATE bloomfilter_uda ( text, int ) SFUNC bloomfilter_udf STYPE bloomfilter_udt INITCOND {};
1) When I call the aggregate, I would like to pass 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'd appreciate some help/hints.
Thanks
Andreas