Loading tutorials
Intermediate · Mid: 18 chapters · 34 min read. States assumed prerequisites
Start readingspark session, which the previous chapter covered.printSchema, show, and display. It assumes you can attach a notebook to compute and that you know what a DataFrame is. It also assumes the notebook already provides a spark session.spark and display. It explains why some lines of Spark code finish instantly and others start a job.spark.createDataFrame. Here you will learn what a schema is, which types you will meet most often, and how to set a schema yospark is already defined, and understand that a DataFrame has a schema. You will read files and tables into DataFrames and avoid the common mistakes.spark is already available, and that you know what a DataFrame is. You should also be comfortable with basic Python or SQL.spark is already defined, and have seen a DataFrame with a schema. It uses the orders DataFrame from earlier chapters, with order_id, customer, order_date and amount columns.select and filter. You should also know that Spark transformations are lazy. Here you will add and change columns with withColumn and related methods.withColumn and filter, and know that transformations are lazy. It covers how Spark treats missing values and repeated rows, and the mistakes that follow from each.withColumn. It uses the orders DataFrame from earlier chapters, in a Databricks notebook where spark already exists.display runs them.groupBy and agg, and read basic PySpark column expressions. It uses the orders DataFrame from earlier chapters, with columns order_id, customer, order_date and amount.F.col and built-in functions, and write basic SQL SELECT ... GROUP BY queries. You will learn to move between the two styles in one notebook.saveAsTable, what the write modes do, and the errors you are most likely to hit.groupBy and join work. Here you will learn to read a query plan, spot the shuffles that make cells slow, and use caching when it helps.withColumn, and use functions from pyspark.sql.functions. It covers two escape hatches from Spark's built-in engine: user-defined functions (UDFs) and conversion to pandas. Both work, and both cost something.