Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Optimizing Databricks Workloads

You're reading from  Optimizing Databricks Workloads

Product type Book
Published in Dec 2021
Publisher Packt
ISBN-13 9781801819077
Pages 230 pages
Edition 1st Edition
Languages
Authors (3):
Anirudh Kala Anirudh Kala
Profile icon Anirudh Kala
Anshul Bhatnagar Anshul Bhatnagar
Profile icon Anshul Bhatnagar
Sarthak Sarbahi Sarthak Sarbahi
Profile icon Sarthak Sarbahi
View More author details

Table of Contents (13) Chapters

Preface Section 1: Introduction to Azure Databricks
Chapter 1: Discovering Databricks Chapter 2: Batch and Real-Time Processing in Databricks Chapter 3: Learning about Machine Learning and Graph Processing in Databricks Section 2: Optimization Techniques
Chapter 4: Managing Spark Clusters Chapter 5: Big Data Analytics Chapter 6: Databricks Delta Lake Chapter 7: Spark Core Section 3: Real-World Scenarios
Chapter 8: Case Studies Other Books You May Enjoy

Working with the OPTIMIZE and ZORDER commands

Delta lake on Databricks lets you speed up queries by changing the layout of the data stored in the cloud storage. The algorithms that support this functionality are as follows:

  • Bin-packing: This uses the OPTIMIZE command and helps coalesce small files into larger ones.
  • Z-Ordering: This uses the ZORDER command and helps collocate data in the same set of files. This co-locality helps reduce the amount of data that's read by Spark while processing.

Let's learn more about these two layout algorithms with a worked-out example:

  1. Run the following code block:
    from pyspark.sql.types import *
    from pyspark.sql.functions import *
    manual_schema = StructType([
      StructField('Year',IntegerType(),True),
      StructField('Month',IntegerType(),True),
      StructField('DayofMonth',IntegerType(),True),
      StructField('DayOfWeek',IntegerType(),True...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}