根据数组<string>

时间:2017-10-17 15:19:01

标签: scala apache-spark apache-spark-sql spark-dataframe

我有一个类型为array<string>的spark 1.6数据帧。该列具有键值对。我想展平列并使用键创建带有值的新列。

以下是我的数据框中的一些行:

[{"sequence":192,"id":8697413670252052,"type":["AimLowEvent","DiscreteEvent"],"time":527638582195}]
[{"sequence":194,"id":8702167944035041,"sessionId":8697340571921940,"type":["SessionCanceled","SessionEnded"],"time":527780267698,"duration":143863999}, {"sequence":1,"id":8697340571921940,"source":"iOS","schema":{"name":"netflixApp","version":"1.8.0"},"type":["Log","Session"],"time":527636403699}, 1]

我可以使用concat_ws来展平数组,但是如何根据数据使用新列呢?

编辑: 除去

0 个答案:

没有答案