Difference b/w reduce and reduceLeft

0 votes
Can you please explain the difference between reduce and reduceLeft. Isn't reduceLeft and reduce?
Jun 20 in Big Data Hadoop by Keshav
89 views

1 answer to this question.

0 votes

The reduceLeft method takes an associative binary operator function as parameter and will use it to collapse elements from the collection. The order for traversing the elements in the collection is from left to right and hence the name reduceLeft. Unlike the foldLeft method, reduceLeft does not allow you to also specify an initial value.

As per the Scala documentation, the definition of the reduceLeft method is as follows:

def reduceLeft[B >: A](op: (B, A) ⇒ B): B

The reduce operation takes all the elements in a collection and combines them in some way to produce a single value. It uses a binary operation to combine the first two values. Then, it takes the result of that first combination and combines it with the next element in the collection, and then the next, and so on through the end of the collection.

The code looks like this:

image

answered Jun 20 by Kriti

Related Questions In Big Data Hadoop

0 votes
1 answer

What is the difference between Map-side join and Reduce-side join?

Join is a clause that combines the records ...READ MORE

answered Dec 13, 2018 in Big Data Hadoop by Omkar
• 67,620 points
156 views
0 votes
1 answer
0 votes
1 answer

What is difference between Oozie workflow, coordinator and bundle ?

Workflow does not have time specifications to ...READ MORE

answered Mar 28, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
637 views
0 votes
1 answer

What's the difference between Hadoop and NoSQL ?

Let's start with the definitions Hadoop is an ...READ MORE

answered Apr 2, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
291 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,670 points
2,971 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,670 points
332 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
14,717 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
1,094 views
0 votes
10 answers

What is the difference between Mongodb and Hadoop?

Apart from the similarity that they are ...READ MORE

answered Dec 6, 2018 in Big Data Hadoop by Deeraj
2,524 views
+2 votes
10 answers

Is there any difference between “hdfs dfs” and “hadoop fs” shell commands?

Yes, there's a difference between hadoop fs and ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Kunal
10,407 views