Is Hive's collect_list ordered?

淺唱寂寞╮ 提交于 2019-12-03 17:31:35

built-in collect_list isn't guaranteed to be ordered, even if you do an order by first (even if it did ensure order, doing it this way is a waste of time). Just use brickhouse collect; it ensures the elements are ordered.

It's correct that collect_list isn't guaranteed to be ordered. The function sort_array will sort the result:

   select a, b, sort_array(collect_list(c)) as sorted_c
   from the_table
   group by a, b
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!