[Transformative Agreement] removed the relations from the ActionSet waiting to have the gree light from Ioanna

This commit is contained in:
Miriam Baglioni 2024-02-19 16:20:12 +01:00
parent f0dc12634b
commit 72bae7af76
1 changed files with 18 additions and 17 deletions

View File

@ -13,6 +13,7 @@ import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.compress.GzipCodec;
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.FilterFunction;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.MapFunction;
@ -77,7 +78,7 @@ public class CreateActionSetSparkJob implements Serializable {
}
private static void createActionSet(SparkSession spark, String inputPath, String outputPath) {
spark
JavaRDD<AtomicAction> relations = spark
.read()
.textFile(inputPath)
.map(
@ -91,8 +92,8 @@ public class CreateActionSetSparkJob implements Serializable {
Encoders.bean(Relation.class))
.filter((FilterFunction<Relation>) Objects::nonNull)
.toJavaRDD()
.map(p -> new AtomicAction(p.getClass(), p))
.union(
.map(p -> new AtomicAction(p.getClass(), p));
//TODO relations in stand-by waiting to know if we need to create them or not In case we need just make a union before saving the sequence file
spark
.read()
.textFile(inputPath)
@ -106,7 +107,7 @@ public class CreateActionSetSparkJob implements Serializable {
Encoders.bean(Result.class))
.filter((FilterFunction<Result>) r -> r != null)
.toJavaRDD()
.map(p -> new AtomicAction(p.getClass(), p)))
.map(p -> new AtomicAction(p.getClass(), p))
.mapToPair(
aa -> new Tuple2<>(new Text(aa.getClazz().getCanonicalName()),
new Text(OBJECT_MAPPER.writeValueAsString(aa))))