排序数组 - Amazon Athena
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

排序数组

创建来自一组行的唯一值的排序数组。

WITH dataset AS ( SELECT ARRAY[3,1,2,5,2,3,6,3,4,5] AS items ) SELECT array_sort(array_agg(distinct i)) AS array_items FROM dataset CROSS JOIN UNNEST(items) AS t(i)

此查询返回:

+--------------------+ | array_items | +--------------------+ | [1, 2, 3, 4, 5, 6] | +--------------------+