ADD JAR hdfs://path_to_brickhouse.jar;CREATE TEMPORARY FUNCTION truncate_array AS'brickhouse.udf.collect.TruncateArrayUDF';-- truncate_array 截取数组时, 长度不够会补 NULLSELECT pkey, IF(size(items_sort) >5, truncate_array(items_sort, 5), items_sort) AS items_sortFROM ( SELECT pkey, sort_array(collect_set(struct(-score, item))).col2 AS items_sort FROM ( SELECT pkey, item, score FROM ... ) A GROUP BY pkey) A;