My Learning Space
​Space to take notes, learn and share.
VARIANT Data Type: Working with Semi-Structured Data in Databricks
Store semi-structured JSON in Databricks with the VARIANT type: the colon operator, schema evolution in place, array explosion, typed views, and a Terraform pipeline.
Distributed Data Scenarios: Handling Skew in Spark’s groupBy Operation
A real-world Spark war story: how a simple groupBy(“city”) created a 1.2 GB skewed task, and how salting plus repartitioning took the job from ~25 minutes to ~6.
Creating DataFrame in pySpark: A Visual Guide
For any data operations in Apache spark, one of the first tasks is creating a DataFrame. This is done using the createDataFrame() API. There are two main things to consider: Data Source – Data can come from a list of dictionaries, a list of lists or tuples, or even...
Writing data with PySpark: A Visual Guide
PySpark in Apache Spark uses the DataFrameWriter to manage how data is saved. To write data in PySpark, you start with the .write attribute of a DataFrame, which gives you a DataFrameWriter to manage the save process. Basic Approach to...
Reading data in pySpark: A Visual Guide
Embedded: PySpark makes it easy to load data from different sources into DataFrames. At first, the process can seem a little overwhelming, but this guide is designed as a visual walkthrough to simplify the concepts. The data...
Apache Spark Execution Flow: A Visual Guide
When a Spark application is submitted, it does not execute statements sequentially. Instead, Spark constructs a logical execution plan, represented as a Directed Acyclic Graph (DAG), which captures the computation flow and dependencies before...