internalsGet Pro

Module 08 · Lesson 4 of 14Pro

Spark DataFrames and Spark SQL

Level
Intermediate
Topic
Batch processing with Spark
Reading time
16 min

When you finish this page you can

  1. Explain how a Spark DataFrame differs from a pandas DataFrame, and why toPandas() on a full day of clicks fails.
  2. Write the same transform with the DataFrame API and with Spark SQL, and explain why both run the same way.
  3. Give a CSV or JSON read an explicit schema instead of inferring one.
  4. Choose between a built-in function, a pandas UDF and a Python UDF for logic inside a query.
  1. DataFrames: pandas and Polars14 min
  2. Spark architecture: driver, executors and tasks17 min

Monday’s notebook asked one machine for 20 GB

is an online store in India. Its apps send about 200 million click events a day, and they land as files in Amazon S3, under clicks/event_date=YYYY-MM-DD/ in the bucket kartly-raw-prod. The category team wants a small daily table from them: product views and add-to-carts per product, loaded into Snowflake for their 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