...

/

Spark SQL - An Example

Spark SQL - An Example

Work through an example that demonstrates executing queries using Spark SQL.

We'll cover the following...

Simple query example

When we execute Spark SQL queries in the spark-shell, we don’t need to explicitly create a SparkSession object. We would if we were writing a Spark application that was to be run using spark-submit. The SparkSession object is provided implicitly by the shell. Read the listing below, which is similar to what we have done in the previous lessons, except for creating the temporary view, which we discuss later.

scala> val movies = spark.read.format("csv")
               
...