Production-grade code patterns across 4 core languages. Optimized for window functions, incremental merges, vector operations, and low-latency analytics.
The entry point to programming Spark with the Dataset and DataFrame API. It explains how to build a local or cluster-connected Spark session with configurations optimized for cloud storage and adaptive query execution in Azure Databricks or Microsoft Fabric.
Reading from and writing to Delta Lake tables, including standard write modes (append, overwrite) and format options. Delta Lake provides ACID transaction guarantees on top of cloud storage like ADLS Gen2 or Microsoft OneLake.
Programmatic definition of schemas to enforce type safety on ingestion, avoiding auto-schema inference performance costs and errors. This is critical when dealing with strictly structured files like regulatory bank exports.
Fundamental transformations to project columns, filter records, add or modify columns, and remove unnecessary fields. These operations are evaluated lazily by Spark's Catalyst Optimizer.
Grouping data by dimensions and performing aggregations like sum, count, and average. GroupBy operations trigger shuffles in a distributed system, reorganizing partitions based on the grouping keys.
Ordering data distributed across partitions and removing duplicate rows based on business keys. Clean and ordered data is critical for accurate reporting and optimized partition storage layouts.
Joining multiple DataFrames using various join types like inner, left, semi, and anti joins. Correct join selection is foundational to master dimensional enrichment and exception checking in Spark.
Creating session-scoped temporary views from DataFrames to enable query writing via Spark SQL. This enables seamless collaboration between Python data engineers and SQL business analysts.
Performing calculations across a set of rows related to the current row without collapsing them. Window functions are highly optimized by Spark for calculating running totals, rankings, and lagged records in financial workflows.
Working with nested schemas, lists, and key-value mapping structures natively in PySpark. This is key for parsing multi-valued JSON structures (like SWIFT/ISO20022 messages) without flattening them prematurely.
Standard practices for cleaning dirty inputs, using conditional logic, and handling missing values safely. Resolving null values ensures accurate calculations in financial rollup reporting.
Extending Spark functionality with custom Python functions. Distinguishes between standard row-by-row Python UDFs and vectorized Pandas UDFs (PyArrow) that perform calculations in batch.
Querying historical versions of a Delta table using transaction log snapshots. This is essential for reconstructing past data states for auditing, debugging, and rollback.
Incrementally and efficiently processing new files as they land in cloud storage (ADLS Gen2 / OneLake) without managing file lists. Auto Loader maintains state using RocksDB checkpoints.
Standard functions for parsing, formatting, and arithmetic operations on dates and timestamps. Critical for defining reporting boundaries and calculating periods in compliance schedules.
Optimizing physical storage layout in cloud storage. Partitioning isolates data into folders based on low-cardinality keys, while bucketing divides data into fixed files based on high-cardinality keys to eliminate shuffles.
Atomic upsert (insert, update, delete) operations inside Delta tables. Crucial for syncing changing master datasets (e.g. customer dimensions) without rewriting whole directories.
Enabling and querying row-level change propagation logs in Delta tables. Allows incremental extraction of changes (inserts, updates, deletes) to populate downstream Gold aggregates efficiently.
Eliminating network shuffle stages when joining a large table with a small reference dataset. PySpark copies the small dataset to all worker executors, keeping the join entirely local.
Caching intermediate DataFrames in executor memory or disk. This avoids re-evaluating long execution lineages when the same DataFrame is accessed multiple times by downstream actions.
Managing the degree of parallelism and layout of partitions in memory. Explains the performance trade-offs between shuffle-inducing repartition and metadata-only coalesce.
Resolving performance bottlenecks caused by uneven data distribution. By appending a randomized suffix (salt key) to skewed keys, transactions are distributed evenly across executors during joins.
Consolidating small files into large ones and organizing layout mapping to speed up queries. Highlights static Z-Ordering vs modern Liquid Clustering for cost-efficient data skipping.
Creating continuous, fault-tolerant ingestion pipelines with low latency. Real-time streams are processed in micro-batches with checkpoints to ensure exactly-once guarantees.
Enforcing security configurations dynamically on PII columns and complying with the GDPR 'Right to be Forgotten' by purging targeted personal details across historical snapshots without compromising table ACID logs.
Designing end-to-end batch and micro-batch data pipelines that guarantee exactly-once delivery, avoiding data duplication during job reruns or mid-execution failures.
Structuring resource policies, configuring instance pools, setting scaling thresholds, and tweaking execution profiles to reduce cloud waste during massive data transformation tasks.
Designing Unified namespaces across business domains. Leverages Microsoft Fabric OneLake shortcuts and Unity Catalog schemas to bridge multi-cloud workloads without replicating files.
Managing concurrent transactions and resolving conflicts. Delta Lake uses Optimistic Concurrency Control (OCC) to handle parallel write operations, failing transactions only if they try to modify the same partitions.
Structuring workspaces and schemas to enforce strict data separation across EU subsidiaries. Uses catalog-level governance to restrict access boundaries and comply with national regulations.
Managing schema changes in medallion pipelines. Demonstrates how to support schema evolution, prevent pipeline failures from schema drift, and route invalid rows to quarantine.
Reading Spark execution query plans and diagnosing performance bottlenecks. Explains how to identify physical plan operators, find data spills, and check task partition details.
Deterministically removes duplicate records for an entity by ranking rows based on timestamp descending and filtering for rank 1.
Ingests continuous file streams with automated schema evolution while routing corrupted or unexpected schema drift into the _rescued_data column.
Appends random numerical salt keys to skewed DataFrames to eliminate straggler tasks and balance partition distribution across executors.
Performs an atomic SCD Type 2 dimension merge, expiring outdated records and inserting active versions with effective dates in a single transaction.
A reusable, modular Python class applying method chaining and dynamic column aggregation expressions to eliminate hardcoded PySpark logic.
Hands-on empirical benchmarking comparing 6 Delta Lake layout and file management techniques (Baseline small files, Physical Partitioning, Z-Ordering, Manual Compaction, Auto Optimize, and Liquid Clustering) across a 50M-row dataset, measuring scan time, input files, and bytes read via the Spark UI.
Production Auto Loader pattern for high-throughput, low-latency file ingestion from cloud object storage (ADLS Gen2 / S3). Implements automatic schema inference, directory notification mode, schema evolution, and bad-data isolation via _rescued_data.
Implements event-time stateful streaming aggregations with watermarking to handle out-of-order and late data cleanly. Uses tumbling and sliding windows with state eviction to prevent executor out-of-memory errors.
Production pattern using foreachBatch to execute multi-table writes and ACID MERGE INTO operations within a streaming pipeline. Solves duplicate delivery issues in streaming CDC pipelines using batch deduplication.
End-to-end Lakeflow Declarative Pipeline (formerly DLT) in Python implementing Bronze-to-Silver-to-Gold streaming medallion architecture with rigorous data quality expectations (@dlt.expect, @dlt.expect_or_drop, @dlt.expect_or_fail).
Architecting and calibrating a Databricks Genie AI/BI space on top of a Kimball dimensional star schema (Sales Fact, Customer Dim, Product Dim, Date Dim), defining semantic instructions, benchmark evaluation questions, and trusted SQL definitions.