Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Databricks Certified Associate Developer for Apache Spark Using Python

You're reading from   Databricks Certified Associate Developer for Apache Spark Using Python The ultimate guide to getting certified in Apache Spark using practical examples with Python

Arrow left icon
Product type Paperback
Published in Jun 2024
Publisher Packt
ISBN-13 9781804619780
Length 274 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Saba Shah Saba Shah
Author Profile Icon Saba Shah
Saba Shah
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Part 1: Exam Overview
2. Chapter 1: Overview of the Certification Guide and Exam FREE CHAPTER 3. Part 2: Introducing Spark
4. Chapter 2: Understanding Apache Spark and Its Applications 5. Chapter 3: Spark Architecture and Transformations 6. Part 3: Spark Operations
7. Chapter 4: Spark DataFrames and their Operations 8. Chapter 5: Advanced Operations and Optimizations in Spark 9. Chapter 6: SQL Queries in Spark 10. Part 4: Spark Applications
11. Chapter 7: Structured Streaming in Spark 12. Chapter 8: Machine Learning with Spark ML 13. Part 5: Mock Papers
14. Chapter 9: Mock Test 1
15. Chapter 10: Mock Test 2
16. Index 17. Other Books You May Enjoy

Collecting the data

A collect statement is used when we want to get all the data that is being processed in different clusters back to the driver. When using a collect statement, we need to make sure that the driver has enough memory to hold the processed data. If the driver doesn’t have enough memory to hold the data, we will get out-of-memory errors.

This is how you show the collect statement:

data_df.collect()

This statement will then show result as follows:

[Row(col_1=100, col_2=200.0, col_3='string_test_1', col_4=datetime.date(2023, 1, 1), col_5=datetime.datetime(2023, 1, 1, 12, 0)),
 Row(col_1=200, col_2=300.0, col_3='string_test_2', col_4=datetime.date(2023, 2, 1), col_5=datetime.datetime(2023, 1, 2, 12, 0)),
 Row(col_1=300, col_2=400.0, col_3='string_test_3', col_4=datetime.date(2023, 3, 1), col_5=datetime.datetime(2023, 1, 3, 12, 0))]

There are a few ways to avoid out-of-memory errors. We will explore some of the options that...

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 €18.99/month. Cancel anytime