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, 2019 in Big Data Hadoop by Keshav
2,542 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, 2019 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
• 69,210 points
5,034 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 29, 2018 in Big Data Hadoop by kurt_cobain
• 9,390 points
2,796 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,390 points
6,023 views
+1 vote
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
• 11,380 points
10,619 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
• 11,380 points
2,215 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
104,968 views
–1 vote
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,390 points
4,297 views
0 votes
10 answers

What is the difference between Mongodb and Hadoop?

MongoDB is a NoSQL database, whereas Hadoop is ...READ MORE

answered Jun 20, 2018 in Big Data Hadoop by jenny_code
11,383 views
+2 votes
10 answers

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

hadoop fs <args> fs is used for generic ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by anonymous
32,635 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP