Ways to create RDD in Apache Spark

0 votes
I'm new to Apache Spark and I want to create RDD so, I saw somewhere that there are 2 ways to create RDD. Can anyone tell me what are the 2 ways and how to create RDD using both the ways?
Jun 19, 2018 in Apache Spark by Shubham
• 13,450 points
2,893 views

1 answer to this question.

0 votes

There are two popular ways using which you can create RDD in Apache Spark.

First is Parallelize and other is text File method. Here is quick explanation how both methods can be used for RDD creation.

val a= Array(5,7,8,9)
val b= sc.parallelize(a)
val c = sc.textFile(“demo.txt”);

Hope you got the answer.

answered Jun 19, 2018 by nitinrawat895
• 10,950 points

Related Questions In Apache Spark

0 votes
1 answer

How to save RDD in Apache Spark?

Hey, There are few methods provided by the ...READ MORE

answered Jul 22, 2019 in Apache Spark by Gitika
• 37,660 points
1,168 views
0 votes
1 answer

what is Paired RDD and how to create paired RDD in Spark?

Hi, Paired RDD is a distributed collection of ...READ MORE

answered Aug 2, 2019 in Apache Spark by Gitika
• 37,660 points
2,644 views
0 votes
1 answer

How to create paired RDD using subString method in Spark?

Hi, If you have a file with id ...READ MORE

answered Aug 2, 2019 in Apache Spark by Gitika
• 37,660 points
671 views
0 votes
12 answers

How to create new column with function in Spark Dataframe?

val coder: (Int => String) = v ...READ MORE

answered Apr 4, 2019 in Apache Spark by anonymous

edited Apr 5, 2019 by Omkar 57,347 views
+1 vote
1 answer
0 votes
1 answer

Writing File into HDFS using spark scala

The reason you are not able to ...READ MORE

answered Apr 5, 2018 in Big Data Hadoop by kurt_cobain
• 9,320 points
11,014 views
0 votes
1 answer

Is there any way to check the Spark version?

There are 2 ways to check the ...READ MORE

answered Apr 19, 2018 in Apache Spark by nitinrawat895
• 10,950 points
3,503 views
0 votes
1 answer

What's the difference between 'filter' and 'where' in Spark SQL?

Both 'filter' and 'where' in Spark SQL ...READ MORE

answered May 23, 2018 in Apache Spark by nitinrawat895
• 10,950 points
16,222 views
0 votes
7 answers

How to print the contents of RDD in Apache Spark?

Save it to a text file: line.saveAsTextFile("alicia.txt") Print contains ...READ MORE

answered Dec 10, 2018 in Apache Spark by Akshay
32,894 views
0 votes
1 answer

How to convert rdd object to dataframe in spark

SqlContext has a number of createDataFrame methods ...READ MORE

answered May 30, 2018 in Apache Spark by nitinrawat895
• 10,950 points
2,539 views