# Mastering Apache Spark Day2 Lab

> In this lab, Zach explains cumulative table design in Spark, focusing on how to build faster downstream historical metrics from minute and daily aggregates. He walks through creating a daily stock metrics table and then building a cumulative table using a full outer join with coalesce and case logi…

- Web page: https://www.dataexpert.io/lesson/mastering-apache-spark-day2-lab-2438
- Program: [Winter 2027 Databricks AI Data Engineer Boot Camp](https://www.dataexpert.io/program/databricks-ai-data-engineer-boot-camp-1198.md)
- Access: Requires enrollment in Winter 2027 Databricks AI Data Engineer Boot Camp
- Length: 49 min video
- Skills: Data Modeling, ETL/ELT, Apache Spark, Git
- Academy: DataExpert.io Academy

## About this lesson

In this lab, Zach explains cumulative table design in Spark, focusing on how to build faster downstream historical metrics from minute and daily aggregates. He walks through creating a daily stock metrics table and then building a cumulative table using a full outer join with coalesce and case logic to track day over day and all time highs. He compares cumulative incremental updates to full recomputation, noting trade offs: cumulative can process far less data but is sequential and adds operational overhead for backfills. He then demonstrates large non splittable file issues using a single gzip, CSV and contrasts it with splittable bzip and Delta, and closes with how Spark skew is handled by adaptive query execution and how to diagnose and mitigate it when needed.

## Navigation

- Previous lesson: [Optimizing Spark in production and balancing costs](https://www.dataexpert.io/lesson/optimizing-spark-in-production-and-balancing-costs-4056.md)
- Next lesson: [Scaling Delta Live Table and Kafka](https://www.dataexpert.io/lesson/scaling-delta-live-table-and-kafka-4103.md)
