在Row Java API中有一个row.schema(),但是没有row.set(StructType模式).
我也试过RowFactorie.create(objets),但我不知道如何继续
更新:
问题是当我修改示例中的工作者的结构时如何生成新的数据帧
DataFrame sentenceData = jsql.createDataFrame(jrdd, schema);
List<Row> resultRows2 = sentenceData.toJavaRDD()
.map(new MyFunction<Row, Row>(parameters) {
/** my map function **//
public Row call(Row row) {
// I want to change Row definition adding new columns
Row newRow = functionAddnewNewColumns (row);
StructType newSchema = functionGetNewSchema (row.schema);
// Here I want to insert the structure
//
return newRow
}
}
}).collect();
JavaRDD<Row> jrdd = jsc.parallelize(resultRows);
// Here is the problema I don't know how to get the new …Run Code Online (Sandbox Code Playgroud) apache-spark ×1