1

I have read this row from a spark DataFrame:

scala> val t = df.take(99)
scala> t(0)(0)
res69: Any = [2,null,WrappedArray([20789823,null,0.0,null,1490788977,1], [50115961,null,0.0,null,1490788977,1], [20787723,null,0.0,null,1490788977,1], [20796254,null,0.0,null,1490788977,1]),null,1488196976]

But unfortunately, I do not know how to access the wrapped array within the Any.

While I can convert it to String and parse the output string, I am looking for the proper way to access the array.

Community
  • 1
  • 1
Uri Goren
  • 13,386
  • 6
  • 58
  • 110

1 Answers1

0

Have you tried using the explode function? It is somehow similar to a flatMap call on collections. Here is an example of using it.

I hope that helps :)

Community
  • 1
  • 1
Andrei T.
  • 2,455
  • 1
  • 13
  • 28