Mastering Azure Databricks for Data Engineers

Apache Spark to Data Engineering Platform

In this lecture we'll look at what Apache Spark is, and just as important, what it is not. Then we'll see why a data engineering platform such as Databricks is needed to build enterprise-grade solutions and to implement the medallion architecture.

What Is Apache Spark?

Apache Spark is an engine for executing data engineering, stream processing, and machine learning on distributed clusters. It offers these capabilities through several interfaces on one framework:

  • Spark SQL, which is ANSI SQL compliant
  • Batch processing APIs, also known as the DataFrame APIs
  • Stream processing APIs, known as Structured Streaming
  • Graph processing APIs
  • Machine learning APIs

Thousands of companies use Spark, including 80% of the Fortune 500.

The Spark Stack

The Apache Spark stack: libraries and Spark Core at the top, then the Spark framework, a cluster resource manager, a cluster of computers, and distributed storageThe Apache Spark stack: libraries and Spark Core at the top, then the Spark framework, a cluster resource manager, a cluster of computers, and distributed storage

Read the stack from the bottom up.

  1. Spark is a framework that runs on a cluster of computers.
  2. To run on a cluster, it needs a cluster resource manager, which you can think of as a cluster operating system. Spark supports YARN, Kubernetes, and its own standalone manager.
  3. To read and write data, Spark integrates with distributed storage: HDFS, Amazon S3, Azure Data Lake Storage (ADLS), and Google Cloud Storage.
  4. On top of the framework sit the Spark Core APIs, also known as the RDD APIs. They are available in Scala, Java, Python, and R. They are not recommended for direct use.
  5. Spark therefore provides more advanced, simpler libraries on top of Spark Core. The most popular are Spark SQL and the DataFrame APIs. The others are Structured Streaming, MLlib, and GraphX.
Output / Note

Note. Spark 4 deprecates R support, and it no longer supports Apache Mesos as a resource manager. In this course we use Python and SQL.

Why Spark Is So Popular

ReasonWhat it means
AbstractionSpark hides the complexity of distributed data processing. You write SQL or DataFrame code, and Spark processes the data in parallel on a cluster without you managing it.
Ease of useSpark SQL is the simplest interface, and the other APIs are available in several languages.
Unified platformSQL, DataFrame processing, batch, stream, machine learning, and graph processing all run on one platform.
Open sourceAnyone can use it, and many companies collaborate on it.
Wide ecosystemBecause it is open source, many tools integrate with it.

What Spark Is Not

Spark is the most popular engine for big data engineering, but an enterprise-grade data engineering solution needs more than Spark provides. Here are five of the most critical things missing from open source Apache Spark.

Five capabilities missing from Apache Spark: data storage infrastructure, ACID transactions, a metadata catalog, cluster management, and automation APIs and toolsFive capabilities missing from Apache Spark: data storage infrastructure, ACID transactions, a metadata catalog, cluster management, and automation APIs and tools

Missing capabilityWhat this means
Data storage infrastructureSpark has no storage layer. It always integrates with something else, such as HDFS, Amazon S3, or ADLS.
ACID transactionsSpark can't ensure ACID compliance by itself. You can add it by integrating another solution, but it isn't part of the Spark project.
A robust metadata catalogSpark has a small, simple catalog, but not a robust, centralized one.
Cluster managementYou can't create, destroy, or manage clusters using Spark. That is the job of a cluster manager.
Automation APIs and toolsSpark has no good set of APIs, SDKs, or command-line tools for automating project activities.

A quick reminder about ACID

ACID stands for atomicity, consistency, isolation, and durability. It is one of the most important features of any data system, and you'll see how it's added to Spark when we get to Delta Lake.

The point is simple. Spark is the most popular engine for data engineering, but it isn't complete on its own. A good enterprise solution needs more, and that's where Spark platforms come in.

Spark Platforms

Five platforms are commonly used to develop and manage enterprise-grade data engineering solutions on Spark.

Platforms for running Spark: Cloudera Hadoop platform, Amazon EMR, Azure HDInsight and Google Dataproc are built on Hadoop technology, while Databricks is a cloud-native Spark platformPlatforms for running Spark: Cloudera Hadoop platform, Amazon EMR, Azure HDInsight and Google Dataproc are built on Hadoop technology, while Databricks is a cloud-native Spark platform

PlatformWhere it runsBased on
Cloudera Hadoop platformOn premises (the most popular on-premises Hadoop platform)Hadoop
Amazon EMRAWSHadoop
Azure HDInsightAzureHadoop
Google DataprocGoogle CloudHadoop
Databricks platformAWS, Azure, and Google CloudSpark and cloud-native technology

Spark can run on a Hadoop cluster, so you can use the first four for Spark applications. The three cloud offerings run on the cloud, but behind the scenes they launch Hadoop clusters, and YARN is mostly the cluster manager.

Databricks is different. It's a purely Spark platform built on the cloud, for the cloud. It doesn't run a Hadoop cluster and doesn't use YARN. It's built using Spark technologies and cloud-native capabilities.

Databricks is not available for on-premises solutions. It is a cloud-native platform.

Summary

  • Apache Spark is a distributed engine for data engineering, streaming, and machine learning, with a unified set of APIs.
  • It is popular because of abstraction, ease of use, a unified platform, open source, and a wide ecosystem.
  • It does not provide storage, ACID transactions, a robust metadata catalog, cluster management, or automation tooling.
  • Spark platforms add these capabilities. Databricks is the cloud-native, Hadoop-free Spark platform this course focuses on.

See you in the next lecture. Keep learning, and keep growing!