The task is to get the tuple with the maximum first item. Is there any better way than the following?
select arrayMax(u.a.1) first_item_max_in_array,
indexOf(u.a.1,first_item_max_in_array) index_in_array,
u.a[index_in_array].2 arg_max_second_item_first_item
from (
select [(1,10),(2,20),(3,30)] a
) u