---
title: "How SCALA and Hadoop Can be Integrated"
description: "Scala is high level language and in the processing of Big data with Hadoop eco system you can use Scala language. Read more."
url: https://srinimf.com/2017/09/08/the-story-develop-scala-applications-to-access-hadoop-data/
date: 2017-09-08
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2017/09/pexels-photo-691919.jpeg?fit=1880%2C1253&ssl=1
categories: ["Hadoop"]
tags: ["Scala in Hadoop", "Scala tips"]
type: post
lang: en
---

# How SCALA and Hadoop Can be Integrated

The name Scala stands for Scalable language. Technically, [Scala](https://srinimf.com/2017/04/03/my-analysis-to-mainframe-alternative-careers/)is a blend of object-oriented and functional programming concepts in a statically typed language.

## This post explains sample SCALA program and how this is integrated to Hadoop.

1. Sample Scala Program
2. Sample Code to get Factorial
3. What is Scala
4. How Scala can be integrated

### **1. Simple Scala program: **

```
var capital = Map("US" -> "Washington", "France" -> "Paris") capital += ("Japan" -> "Tokyo") 
println(capital("France"))
```

How the above program works This program sets up a map from countries to their capitals, modifies the map by adding a new binding (“Japan” -> “Tokyo”), and prints the capital associated with the country France.

### **2. The sample code to get factorial **

```
def factorial(x: BigInt): BigInt = if (x == 0) 1 else x * factorial(x - 1)
```

if you call factorial(30) you would get: 265252859812191058636308480000000

**Scala is pure object oriented: Scala is an [object-oriented language](http://www.webopedia.com/TERM/O/object_oriented_programming_OOP.html) in pure form: every value is an object and every operation is a method call. **

For example, when you say 1 + 2 in Scala, you are actually invoking a method named + defined in class Int. You can define methods with operator-like names that clients of your API can then use in operator notation.

Scala is also a functional language: In addition to being a pure object-oriented language, Scala is also a full blown functional language. Scala doesn’t require you to leap backwards off the Java platform to step forward from the Java language.

It allows you to add value to existing code—to build on what you already have—because it was designed for seamless interoperability with Java.

### **3. Scala is high-level language.**

// this is Java boolean

```
nameHasUpperCase = false; for (int i = 0; i < name.length(); ++i) 
{ if (Character.isUpperCase(name.charAt(i))) { nameHasUpperCase = true; break; } }
```

**Whereas in Scala, you could write this: **

```
val nameHasUpperCase = name.exists(_.isUpper)
```

The above example tells how simple you can write complex logic in one or two line. You can take [QUIZ on Scala here](http://www.biganalytics.me/2015/10/top-10-scala-quiz-questions-for.html).

Related[Adobe Flex Quiz: 10 Top Questions](https://srinimf.com/2018/05/27/adobe-flex-quiz-questions/)

![Scala in Hadoop Eco system](https://weidongzhou.files.wordpress.com/2015/09/spark_engine.jpg?resize=497%2C297)*Scala in Hadoop Eco system*

### **4. How Scala and Hadoop both can be integrated**

Scala is used in some of the Hadoop ecosystem components like Apache Spark, Apache Kafka, etc. So it would be really useful for someone to develop applications using Scala that uses Hadoop and the ecosystem projects. You can read a [best example with Scala how to access Hadoop data.](https://mapr.com/blog/scala-applications-access-hadoop-data/)

Related Posts

- [A Step-by-Step Guide to Running a Scala Program](https://srinimf.com/2021/09/03/scala-shell-how-to-run-commands-useful-video/)DateSeptember 3, 2021
- [How to Install HBase Properly](https://srinimf.com/2021/03/14/how-to-install-hbase-properly/)DateMarch 14, 2021
- [Java Array Vs. Scala Array Which is Easy](https://srinimf.com/2021/07/23/scala-vs-java-the-real-difference-in-array/)DateJuly 23, 2021

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2017%2F09%2F08%2Fthe-story-develop-scala-applications-to-access-hadoop-data%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2017%2F09%2Fpexels-photo-691919.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=How%20SCALA%20and%20Hadoop%20Can%20be%20Integrated)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2017/09/08/the-story-develop-scala-applications-to-access-hadoop-data/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2017/09/08/the-story-develop-scala-applications-to-access-hadoop-data/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2017/09/08/the-story-develop-scala-applications-to-access-hadoop-data/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2017/09/08/the-story-develop-scala-applications-to-access-hadoop-data/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20SCALA%20and%20Hadoop%20Can%20be%20Integrated&body=https%3A%2F%2Fsrinimf.com%2F2017%2F09%2F08%2Fthe-story-develop-scala-applications-to-access-hadoop-data%2F&share=email)
-

### Like this:

Like Loading…
