Hive arg_max and arg_min ------------------------ Key: HIVE-888 URL: https://issues.apache.org/jira/browse/HIVE-888 Project: Hadoop Hive Issue Type: New Feature Reporter: Zheng Shao
We want a way to let Hive return the row with the maximum value of one field. There are 2 approaches: A1. Support arg_min and arg_max: {code} SELECT userid, ARG_MAX(action_time, action_type), ARG_MAX(action_time, action_target) FROM userlog; {code} A2. Support struct<...> and let max, min take a struct and compare field by field. {code} SELECT userid, MAX(struct(action_time:action_time, action_type:action_type, action_target:action_target)) FROM userlog; {code} I think A2 should be easier to understand. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.