changed Encorders.bean to Encoders.kryo

This commit is contained in:
Miriam Baglioni 2020-05-07 11:44:35 +02:00
parent 207b899d6d
commit 9f8855991c
1 changed files with 1 additions and 2 deletions

View File

@ -71,7 +71,6 @@ public class SparkCountryPropagationJob3 {
Class<? extends Result> resultClazz = (Class<? extends Result>) Class.forName(resultClassName); Class<? extends Result> resultClazz = (Class<? extends Result>) Class.forName(resultClassName);
SparkConf conf = new SparkConf(); SparkConf conf = new SparkConf();
conf.registerKryoClasses(ModelSupport.getOafModelClasses());
runWithSparkSession( runWithSparkSession(
conf, conf,
@ -101,7 +100,7 @@ public class SparkCountryPropagationJob3 {
spark spark
.read() .read()
.json(inputPath) .json(inputPath)
.as(Encoders.kryo(resultClazz)) .as(Encoders.bean(resultClazz))
.groupByKey((MapFunction<R, String>) result1 -> result1.getId(), Encoders.STRING()) .groupByKey((MapFunction<R, String>) result1 -> result1.getId(), Encoders.STRING())
.mapGroups(getCountryMergeFn(resultClazz), Encoders.bean(resultClazz)) .mapGroups(getCountryMergeFn(resultClazz), Encoders.bean(resultClazz))
.write() .write()