Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

The story develop Scala applications to access Hadoop data

The name Scala stands for Scalable language. Technically, Scala is a blend of object-oriented and functional programming concepts in a statically typed language.

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.

Stockphotos.io

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 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 fullblown 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.

Scala is high-level language.

// this is Java boolean

nameHasUpperCase = false; for (int i = 0; i 

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.

Scala in Hadoop Eco system

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.


Filed under: Hadoop Tagged: Scala in Hadoop, Scala tips


This post first appeared on Srinimf - Tech.Jobs.Biz.Success, please read the originial post: here

Share the post

The story develop Scala applications to access Hadoop data

×

Subscribe to Srinimf - Tech.jobs.biz.success

Get updates delivered right to your inbox!

Thank you for your subscription

×