09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7

Analytics at Scale

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.mapred.TextInputFormat;

@SuppressWarnings("deprecation")

public class MapreduceJoin {

////////////////////////////////////////////////////////

@SuppressWarnings("deprecation")

public static class JoinReducer extends MapReduceBase

implements Reducer<Text, Text, Text, Text>

{

public void reduce(Text key, Iterator<Text>

values, OutputCollector<Text, Text> output,

Reporter reporter) throws IOException

{

ArrayList<String> translist = new

ArrayList<String>();

String secondvalue = "";

while (values.hasNext())

{

String currValue = values.next().

toString().trim();

if(currValue.contains("trans:")){

String[] temp = currValue.

split("trans:");

if(temp.length > 1)

translist.

add(temp[1]);

}

if(currValue.contains("sec:"))

162

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!