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?
Does row.getAs[Seq[String]]("result")
work?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With