Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read Array of String from Spark

I saved an Array[String] to a Parquet file from Spark.

To read it I use:

row.getAs[Array[String]]("result")

But get:

java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofRef cannot be cast to [Ljava.lang.String;

Here is the result of printSchema():

root                                                                            
 |-- result: array (nullable = true)
 |    |-- element: string (containsNull = true)

How should the getAs() be modified?

like image 431
BAR Avatar asked Oct 18 '15 22:10

BAR


1 Answers

Does row.getAs[Seq[String]]("result") work?

like image 161
Reactormonk Avatar answered Sep 22 '22 07:09

Reactormonk