I was able to make this work using the following UDF/UDA:
CREATE OR REPLACE FUNCTION agg_set_func(state tuple>, val
set) CALLED ON NULL INPUT RETURNS tuple> LANGUAGE
java AS
$$
if (val == null) {
return state;
}
Set s = state.getSet(1, Long.class);
s.addAll(val);
Thank you for your reply. I actually found your blog post regarding this
topic and browsed through it, but it did not yield the answer I was looking
for. In fact, it seems impossible to do what I wish to do without defining
a UDA for this specific use case -- something that is not practical to do
You will need to use user defined aggregates for this
Le 23 oct. 2018 16:46, "Joseph Wonesh" a
écrit :
> Hello all,
>
> I am trying to aggregate rows which each contain a column of Set.
> I would like the result to contain the sum of all sets, where null would be
> equivalent to the empty set.
Hello all,
I am trying to aggregate rows which each contain a column of Set.
I would like the result to contain the sum of all sets, where null would be
equivalent to the empty set. I expected a query like: "select
sum(my_set_column) from my_table group by my_key_column" to do this, but
the set