I want to write a custom UDF (UDAF/UDTF) that can take in a constant parameter.
For example, I want to write a function MAX(COL, i), where COL is the collection of values to find the max value, and i is the position (ie. i = 1, find the highest, i = 2, find the second highest, etc.), such that the Hive query looks like:
SELECT
MAX(value, 2)
FROM table;
This isn't just for MAX, so I need a general way of being able to do this, so sorting and selecting from the sorted collection will not work.