with t as (
select 10 as key, ‘apple’ as value
union all
select 3 as key, ‘banana’ as value
union all
select 4 as key, ‘candy’ as value
)
select
to_ordered_map(key, value, true), — {10:”apple”,4:”candy”,3:”banana”} (reverse)
to_ordered_map(key, value, 1), — {10:”apple”} (top-1)
to_ordered_map(key, value, 2), — {10:”apple”,4:”candy”} (top-2)
to_ordered_map(key, value, 3), — {10:”apple”,4:”candy”,3:”banana”} (top-3)
to_ordered_map(key, value, 100), — {10:”apple”,4:”candy”,3:”banana”} (top-100)
to_ordered_map(key, value), — {3:”banana”,4:”candy”,10:”apple”} (natural)
to_ordered_map(key, value, -1), — {3:”banana”} (tail-1)
to_ordered_map(key, value, -2), — {3:”banana”,4:”candy”} (tail-2)
to_ordered_map(key, value, -3), — {3:”banana”,4:”candy”,10:”apple”} (tail-3)
to_ordered_map(key, value, -100) — {3:”banana”,4:”candy”,10:”apple”} (tail-100)
from t