1
0
Fork 0

moved the creation of new dir to common class.

This commit is contained in:
Miriam Baglioni 2020-03-17 16:31:24 +01:00
parent 92f4e0001d
commit b4652d018c
1 changed files with 10 additions and 0 deletions

View File

@ -2,12 +2,15 @@ package eu.dnetlib.dhp;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.*; import eu.dnetlib.dhp.schema.oaf.*;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Text;
import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.PairFunction; import org.apache.spark.api.java.function.PairFunction;
import scala.Tuple2; import scala.Tuple2;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -188,4 +191,11 @@ public class PropagationConstant {
.saveAsTextFile(outputPath+"/"+type); .saveAsTextFile(outputPath+"/"+type);
} }
public static void createOutputDirs(String outputPath, FileSystem fs) throws IOException {
if (fs.exists(new Path(outputPath))) {
fs.delete(new Path(outputPath), true);
fs.mkdirs(new Path(outputPath));
}
}
} }