Description
These 2 UDAFs should return the max n numbers, min n numbers in order.
SELECT max_n(userid, 3) FROM src; [999,997,996] SELECT max_n(userid, 3)[1] FROM src; 997 SELECT min_n(userid, 3) FROM src; [0, 3, 8] SELECT min_n(userid, 3)[2] FROM src; 8