- 使用mapPartition提升map类操作的性能
数据量不是特别大的时候,都可以用这种MapPartitions系列操作,性能还是非常不错的,是有提升的。
mapToPair----->mapPartitionsToPair
return actionRDD.mapToPair(new PairFunction<Row, String, Row>() {
@Override
public Tuple2<String, Row> call(Row row) throws Exception {
return new Tuple2<String, Row>(row.getString(2),row);
}
});
return actionRDD.mapPartitionsToPair(new