Building Sample RDD
Let us build a sample rdd to print from in Scala.
import org.apache.spark.sql.SparkSession
val spark: SparkSession = SparkSession.builder().master("local[1]").getOrCreate()
val rdd=spark.sparkContext.parallelize(Seq(("Tutorials", "Print Rdd"),
("Language", "Scala"), ("Platform", "Gfg")))
Here we have just a simple rdd and filled in some values.
How to Print RDD in scala?
Scala stands for scalable language. It was developed in 2003 by Martin Odersky. It is an object-oriented language that provides support for functional programming approach as well. Everything in scala is an object e.g. – values like 1,2 can invoke functions like toString(). Scala is a statically typed language although unlike other statically typed languages like C, C++, or Java, it doesn’t require type information while writing the code. The type verification is done at the compile time. Static typing allows to building of safe systems by default. Smart built-in checks and actionable error messages, combined with thread-safe data structures and collections, prevent many tricky bugs before the program first runs.
Table of Content
- Understanding RDD and Spark
- Building Sample RDD
- How to Print RDD in Scala?
- Conclusion
Contact Us