Spark – Scala

My colleague share a book that he bought with me – “Machine Learning with Spark“. I read the part of the first chapter and feel pretty good about. I think it is definitely a hard book for the ones who doesn’t have that much programming experience, the Author probably has the assumption that the reader should know one of the three languages(Java, Python, Scala) at least to even read the book.

I have been doing some Spark programming in Python and today, I read a few examples written in Scala, the syntax is extremely simple and similar as Python. I have also heard from some people that Scala code will run much faster than Pyspark most of the cases. Here are a few things that are new to me:

  1. use “val” whenever to create a new variable
  2. => is the anonymous function
  3. map{ case (a,b,c) => (b,c) } where case will contain a block of code
  4. .reduceByKey(_ + _)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s