我尝试从数据集中获取一行,并且能够从数据集中获取一行,但是每当我尝试返回列表时,它就会抛出java.lang.string cannot cast into apache.spark.sql.Row
我尝试过的以下代码
List<Row> lisdata=new ArrayList<Row>();
//whileiteration
//jsonobjectdata
//{"firstname":"john","lastname":"snow","work":"nightwatcher"}
Row rowdata=Rowfactory.create(jsonobjectdata);
lisdata.add(rowdata.get(0));
return lisdata.iterator();