You will need UDF for this. Klout has a bunch of open source HivUDFS under the brick house package. Here is the github link . They have a bunch of UDF that exactly matches your purpose. Download, create and add a JAR. Here is an example
CREATE TEMPORARY FUNCTION combine AS 'brickhouse.udf.collect.CombineUDF';
CREATE TEMPORARY FUNCTION combine_unique AS 'brickhouse.udf.collect.CombineUniqueUDAF';
select combine_unique(combine(array('a','b','c'), array('b','c','d'))) from reqtable;
OK
["d","b","c","a"]
source
share