运算
高级转换的实现。
使用
加载数据到Spark如果你正在使用Apache Spark,函数将迭代数据集并加载它到一个Spark RDD里并把原始数据转换为一个Writable。
RDD里并把原始数据转换为一个Writable。import org.datavec.api.writable.Writable;
import org.datavec.api.records.reader.impl.csv.CSVRecordReader;
import org.datavec.spark.transform.misc.StringToWritablesFunction;
SparkConf conf = new SparkConf();
JavaSparkContext sc = new JavaSparkContext(conf)
String customerInfoPath = new ClassPathResource("CustomerInfo.csv").getFile().getPath();
JavaRDD<List<Writable>> customerInfo = sc.textFile(customerInfoPath).map(new StringToWritablesFunction(rr));Last updated
Was this helpful?