The table orders has some fields as following:
orderkey, product, amount, order_month, ......
I want to implement a UDF to use like:
select product, udf_topN(amount, -5) from orders group by product
this query means selecting the top 5 records by amount descending sort in each product group.
Can I implement this function using PL/Java and how to do? Please tell me where I can find such documents or information.