internalsGet Pro

Module 08 · Lesson 5 of 14Pro

Lazy evaluation and Spark query plans

Level
Intermediate
Topic
Batch processing with Spark
Reading time
16 min

When you finish this page you can

  1. Tell transformations from actions in PySpark, and say when Spark reads data.
  2. Describe how Spark turns a DataFrame query into a physical plan, and what the optimizer changes on the way.
  3. Read a physical plan from explain() and check its partition filters, pushed filters and read schema.
  4. Keep filters visible to the optimizer by using built-in column expressions instead of Python UDFs.

Builds on 3 lessons

Start with lesson 317 min
  1. Spark architecture: driver, executors and tasks17 min
  2. Spark DataFrames and Spark SQL16 min
  3. DataFrames: pandas and Polars14 min

A one-week job read thirteen months

is an online store in India. At its current size, its apps send about 200 million click events a day. A Kafka Connect sink lands them in S3 as , one folder per day, under s3://kartly-raw-prod/clicks/event_date=YYYY-MM-DD/. Thirteen months of folders are kept. Meera, a data engineer on Kartly’s data team, reads them with Spark for the product team’s reports.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan