Read an array of strings from a spark

I saved Array[String] in the Parquet file from Spark.

To read this, I use:

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

But we 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 to change getAs() ?

+7
scala apache-spark
source share
1 answer

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

+16
source share

All Articles