如何在配置单元中连接多个数组列?

mwg9r5ms  于 2021-06-26  发布在  Hive
关注(0)|答案(10)|浏览(281)

在配置单元表中,假设数据如下所示: `+----+

eoigrqb6

eoigrqb61#

--------+` 在我的实际示例中,内部类型不是基本类型,因此转换为字符串不起作用。如何在配置单元中连接数组列?

omhiaaxx

omhiaaxx2#

--------+ | 1 | [2, 3, 4, 5, 6] | | 2 | [7, 8, 9] | +----+

jei2mxaa

jei2mxaa3#

-+我想得到这样的东西:+----+

brgchamk

brgchamk4#

--------+ | id | concatenated_ids | +----+

bweufnob

bweufnob5#

-+ | 1 | [2, 3] | [4, 5, 6] | | 2 | [7] | [8, 9] | +----+

2fjabf4q

2fjabf4q7#

-+ | id | some_ids1 | some_ids2 | +----+

0ve6wy6x

0ve6wy6x10#

使用通用的udf传递这两列,并将其连接起来,然后作为数组返回。

public class ArraySum extends UDF {
  public List<Double> evaluate(List<Double> list1, List<Double> list2) {
    return list1.addAll(list2)
  }
}

希望这有帮助!

相关问题