What filter transformation in apache spark?

0 votes
Can anyone explain how filter transformation works in apache spark?
Aug 2 in Apache Kafka by Badri
40 views

1 answer to this question.

0 votes

Hi,

Filter() transformation in Apache Spark takes function as input.

It returns an RDD that only has element that pass the condition mentioned in input function.

val rdd1 = sc.parallelize(List(10,20,40,60)) 

val rdd2 = rdd2.filter(x => x !=10) println(rdd2.collect())

Output will be:

10.

answered Aug 2 by Gitika
• 25,420 points

Related Questions In Apache Kafka

0 votes
1 answer

What is the optimum number of producers to create in Kafka?

In general, a single producer for all ...READ MORE

answered Jul 10, 2018 in Apache Kafka by nitinrawat895
• 10,760 points
1,626 views
0 votes
1 answer

Is there any change in consumer offsets if a new partition(s) is added to a Kafka topic?

Yes, it stays the same. An offset is ...READ MORE

answered Jul 9, 2018 in Apache Kafka by nitinrawat895
• 10,760 points
354 views
0 votes
1 answer

How to commit message offsets in Kafka for reliable data pipeline?

You can use auto.commit.enable to allow Kafka ...READ MORE

answered Jul 9, 2018 in Apache Kafka by Shubham
• 13,350 points
384 views
0 votes
1 answer

How to delete a topic in Kafka 0.8.1.1?

Deleting topic isn't always working in 0.8.1.1 Deletion ...READ MORE

answered Sep 4, 2018 in Apache Kafka by nitinrawat895
• 10,760 points
210 views
0 votes
1 answer

Retention in Kafka Cluster

However, retention period retains all the published ...READ MORE

answered Sep 18, 2018 in Apache Kafka by kurt_cobain
• 9,280 points
186 views
+1 vote
2 answers

Getting error in schema-registry start command

It is working for me with below ...READ MORE

answered Sep 30 in Apache Kafka by Brajkishore
• 240 points
462 views
+1 vote
1 answer
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,760 points
3,515 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,760 points
431 views
+1 vote
11 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
17,842 views