A Simple Application in Spark and Scala

Table of contents
Reading Time: < 1 minute

In this blog, we will see how to build a Simple Application in Spark and Scala using sbt.

Spark is a Map-Reduce like cluster computing framework, designed to make data analytics fast.

In this application we will count the number of lines containing “the”. To build this application we are going to use Spark 0.9.1, Scala 2.10.3 & sbt 0.13.0.

Before start building this application follow these instructions :-

1). Download Spark 0.9.1.

2). Unzip the binary package in any directory.

3). Go to the Spark directory.

4) Run ./sbt/sbt assembly

To successfully build Spark with sbt we need sbt 0.13.0 or later versions already installed in system.

After building Spark, we can start building the Application.

To build the Application follow these steps:

1). Run mkdir SimpleSparkProject.

2). Create a .sbt file in SimpleSparkProject/simple.sbt

3). Create a file SimpleSparkProject/src/main/scala/SimpleApp.scala

4). Then go to SimpleSparkProject directory.

5). Run  sbt package

6). Run sbt run

To download a Demo Application click here.

Written by 

Himanshu Gupta is a software architect having more than 9 years of experience. He is always keen to learn new technologies. He not only likes programming languages but Data Analytics too. He has sound knowledge of "Machine Learning" and "Pattern Recognition". He believes that best result comes when everyone works as a team. He likes listening to Coding ,music, watch movies, and read science fiction books in his free time.

5 thoughts on “A Simple Application in Spark and Scala1 min read

Comments are closed.