

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solution exercice examen 2025 Big data
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Exercice 2 : Big Data Considérons un dossier HDFS nommé inputData qui contient les fichiers suivants : Temperature1.txt, Temperature2.txt et Temperature3.txt de tailles 1036MB, 513MB et 500MB respectivement. Soit le programme MapReduce suivant exécuté sur les fichiers ci-dessus. class MapperBigData extends Mapper { protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String fields[] = value.toString().split(","); String date = fields[0]; Double temperature = Double.parseDouble(fields[2]); context.write(new Text(date), new DoubleWritable(temperature)); } } class ReducerBigData extends Reducer { @Override protected void reduce(Text key, // Input key type Iterable values, // Input value type Context context) throws IOException, InterruptedException { double maxTemp = Double.MIN_VALUE; for (DoubleWritable temperature : values) { if (temperature.get() > maxTemp) { maxTemp = temperature.get(); } } context.write(key, new DoubleWritable(maxTemp)); } }
c. 2016/01/01,00:00:10,-1. d. 2016/01/01,00:00:15,-1. e. 2016/01/01,00:00:20,-1. f. 2016/01/01,00:00:25,-0. g. 2016/01/01,00:00:30,-0. h. 2016/01/01,00:00:35,1. i. 2016/01/01,00:00:40,1.