Я делаю что-то вроде этого
val domainList = data1.select("columnname","domainvalues").where(col("domainvalues").isNotNull).map(r => (r.getString(0), r.getList[String](1).asScala.toList)).collect()
domainList должен иметь тип Array [(String, List [String])]
Для ввода DF:
+-------------+----------------------------------------+
|columnname |domainvalues |
+-------------+----------------------------------------+
|predchurnrisk|Very High,High,Medium,Low |
|userstatus |Active,Lapsed,Renew |
|predinmarket |Very High,High,Medium,Low |
|predsegmentid|High flyers,Watching Pennies,Big pockets|
|usergender |Male,Female,Others |
+-------------+----------------------------------------+
Ошибка, которую я получаю:
java.lang.ClassCastException: java.lang.String cannot be cast to scala.collection.Seq
at org.apache.spark.sql.Row$class.getSeq(Row.scala:283)
at org.apache.spark.sql.catalyst.expressions.GenericRow.getSeq(rows.scala:166)
at org.apache.spark.sql.Row$class.getList(Row.scala:291)
at org.apache.spark.sql.catalyst.expressions.GenericRow.getList(rows.scala:166)
at com.fis.sdi.ade.batch.SFTP.Test$$anonfun$6.apply(Test.scala:53)
at com.fis.sdi.ade.batch.SFTP.Test$$anonfun$6.apply(Test.scala:53)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCodegenStage2.mapelements_doConsume_0$(Unknown Source)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCodegenStage2.deserializetoobject_doConsume_0$(Unknown Source)
Как мне решить эту проблему?