Scala Code snippets

Spark Scala

Convert string to date in Scala / Spark

This code snippet shows how to convert string to date.

View detail
Spark Scala

Write and read parquet files in Scala / Spark

Parquet is columnar store format published by Apache. It's commonly used in Hadoop ecosystem. There are many programming language APIs that have been implemented to support writing and reading parquet files. 

View detail
Spark (v2.x) Scala

Read JSON file as Spark DataFrame in Scala / Spark (v2.x)

Spark has easy fluent APIs that can be used to read data from JSON file as DataFrame object. 

View detail
Spark (v2.x) Scala

Convert List to Spark Data Frame in Scala / Spark (v2.x)

In Spark, SparkContext.parallelize function can be used to convert list of objects to RDD and then RDD can be converted to DataFrame object through SparkSession.

View detail