小编Aru*_*ave的帖子

Presto SQL-如何获得数组的所有可能组合?

我想要给定数组中所有可能的数字组合。

我试过使用presto的一些预定义函数,例如array_agg(x)

Input : [1,2,3,4]
Output
when n=2 : [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
when n=3 : [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
when n=4 : [[1,2,3,4]] or [1,2,3,4]
Run Code Online (Sandbox Code Playgroud)

database arrays hive presto

5
推荐指数
1
解决办法
106
查看次数

Presto-如何过滤连续出现的数组值

我想从连续发生的数组中筛选出值。

我尝试过使用“ array_distinct”和“ transform”函数,但是无法进行。由于array_distinct仅提供不同的值而不是我期望的

Input : [1,2,2,3,4,4,4,2]
Run Code Online (Sandbox Code Playgroud)

预期输出:[1,2,3,4,2]

arrays presto

2
推荐指数
1
解决办法
105
查看次数

标签 统计

arrays ×2

presto ×2

database ×1

hive ×1