Improve your coding skills from beginner to expert with the largest online Java e-learning platform

Spark Module 2 SparkSQL and DataFrames

featuring SQL and DataFrames.
  • The second module in the Spark series moves on to explore the SparkSQL and DataFrames API. This allows us to concentrate on the Data Science and work at a much higher level of abstraction, working with SQL style syntax instead of worrying about RDDs.
  • This course is designed for all Java developers who want to explore Spark. No previous data science experience is assumed, so every concept is explained in detail.


Previous knowledge of RDDs in Spark is assumed - module 1 in the series covers this.

Contents - This course is around 5 hours long.


Having problems? check the errata for this course.



6 m 29 s
What do DataFrames and SparkSQL offer compared to SparkCore (RDDs)?


Getting Started

20 m 10 s
We'll read in a DataSet (DataFrame) to get started


Working with DataSets

29 m 3 s
For our first real task with SparkSQL, we'll see how do filters


Full SQL Syntax

13 m 45 s
How to query Spark using the full SQL syntax


In Memory Data

15 m 4 s
In Module 1 we used parallelize to use in memory data - useful for unit tests. This is how to do it using DataFrames.


Grouping and Aggregating

12 m 59 s
Understanding the Group By clause in SparkSQL


Date Formatting

6 m 30 s
How to use the date_format function in SparkSQL


Multiple Groupings

13 m 59 s
More than one group by column?



16 m 36 s
How to use the order by clause


DataFrames API

28 m 4 s
We've concentrated on the SQL syntax so far, but we can also use a Java API to do everything (and more) that SQL can.


Pivot Tables

21 m 21 s
In DataFrames, we can produce Pivot Tables as with spreadsheets and databases. But for Big Data!


General Aggregations

18 m 49 s
The agg method is the most flexible aggregating function, so we'll see how to use it.


Practical Session

8 m 12 s
A short exercise


User Defined Functions

23 m 55 s
How to use lambdas to add your own functions to the SQL syntax and DataFrame API



25 m 56 s
Using the SparkUI to analyse tasks. We ask the question: is the SQL syntax slower than the DataFrame API? Answers will follow in the next video...



39 m 21 s
Spark has two strategies for grouping - HashAggregation is extremely efficient but can only be used in restricted circumstances. Find out how to make sure HashAggegration is used instead of the (usually) slower SortAggregate routine.


SparkSQL vs SparkRDD

6 m 55 s
Which performs "better"?

Update - Tuning the spark.sql.shuffle.partitions Property

8 m 18 s
An update - by default you will have a large number of partitions when shuffling (such as when grouping) - this can kill performance on small jobs. This is how to fix the problem.


Module Summary

2 m 24 s
Coming up later in 2018 is a module on SparkML.

Let the Course Come to You

About Us Pricing Frequently Asked Questions Contact Privacy T&Cs Affiliates and Resellers
Facebook Twitter YouTube LinkedIn