Why AQE Coalesces Shuffle Partitions (and When It Can't Help)
How Adaptive Query Execution merges small shuffle partitions at runtime, the settings that control it, and the cases where you still have to tune.
Long-form deep dives and short learnings from real pipelines — every code block runs.
How Adaptive Query Execution merges small shuffle partitions at runtime, the settings that control it, and the cases where you still have to tune.
Read the article →
How Adaptive Query Execution merges small shuffle partitions at runtime, the settings that control it, and the cases where you still have to tune.
Both load files into Delta exactly once. The choice comes down to file volume over the table's lifetime, who maintains the pipeline, and how often you need to reload a subset.
Twenty scenario-based data modeling problems asked in data engineer and analytics engineer interviews, with what the interviewer is checking and a strong answer for each.
One databricks.yml, three environments, zero clicking. Bundle structure, targets and modes, variables, and a promotion pipeline that deploys as a service principal.
The three settings that decide whether Auto Loader is cheap and boring or expensive and surprising — file discovery mode, schema evolution mode, and what actually lives in the checkpoint.
Which trigger mode to pick and what it costs, what actually lives in a checkpoint, and the three conditions exactly-once depends on — one of which is your code.
Warn, drop or fail — the three expectation actions, the quarantine pattern that's better than all of them, and how to keep quality rules out of your pipeline code.
A CDC feed sends duplicates and out-of-order changes. Build a MERGE that keeps the latest row per key, ignores late events and is safe to replay.
Enable Change Data Feed and read row-level inserts, updates and deletes by version to refresh downstream Delta tables incrementally.
When to use a shallow clone, a deep clone or RESTORE: test on real data, take real backups, and roll back bad writes safely.
Deletion vectors mark rows instead of rewriting files; row tracking gives rows stable IDs. How both work, what they cost, and how to purge.
Identity keys, computed columns and defaults in Delta: what each guarantees, what it doesn't, and the concurrency trade-off that bites.
25 scenario-based Delta Lake interview questions in five areas, with what the interviewer is checking and a strong answer for each.
The five Delta MERGE patterns (upsert, insert-only, newer-wins, deletes, full sync), the errors that break them, and how to make them fast.
Query old Delta versions, compare them, recover from a bad write, and set retention correctly now that Runtime 18 changed the rules.
OPTIMIZE compacts, Z-ORDER sorts, VACUUM deletes. How each works, how to schedule them, and what predictive optimization and Runtime 18 changed.
Delta rejects mismatched writes by default. How to allow new columns, wider types, renames and drops on purpose, one write at a time.
Why Delta tables collect tiny files, how to measure it, and the writer fixes and compaction strategies that stop it coming back.
Read _delta_log yourself: what commits and checkpoints contain, how readers build snapshots, and how concurrent writers avoid corruption.
The three table formats now share most features. What still differs: metadata design, engine and catalog support, and write patterns.
Four names, one engine, four years. A short map of what got renamed, what got open-sourced, what your old code still does, and which word to use in an interview.
Three fact table types answer three kinds of question: what happened, what's the position, and how far along is it. Build each on Delta Lake, and avoid summing what shouldn't be summed.
Three modeling styles, three different problems they solve. A decision framework based on source count, audit needs, team size and consumers, plus the hybrid most lakehouses end up with.
What a managed connector actually runs on your behalf — the ingestion gateway, staging and pipeline — plus when a connector beats hand-rolled CDC and when it doesn't.
Build a job graph that survives a bad night — run_if conditions for error handling, the five trigger types and their limits, and why repair runs only help idempotent tasks.
Build your first declarative pipeline end to end — streaming tables, materialized views, flows and the pipeline graph — using the pyspark.pipelines API that replaced import dlt.
Facts that show up before their customer exists, and facts that show up weeks after the event. Inferred members, point-in-time joins and re-keying jobs on Delta Lake, with the trade-offs of each.
Three ways to make Delta skip files, compared on cost and flexibility, with a decision order, migration steps and when partitioning still wins.
A practical pattern for turning deeply nested structs, arrays, and maps into flat, queryable tables — without hardcoding every field path.
50 PySpark interview questions across transforms, joins, windows, partitioning, performance, streaming, Delta Lake, and system design — with answers, not just questions.
A field checklist for slow or expensive PySpark jobs: baseline first, then read less, shuffle less, balance the work, compute smarter, use memory well and write right.
A field guide to when built-ins, Pandas UDFs and plain Python UDFs actually make sense, with the serialization cost that explains the gap between them.
Running totals, rankings, lag/lead comparisons, and moving averages in PySpark — what a window actually is under the hood and where it gets expensive.
A practical route through the Spark UI: map a slow query to its stage, read the summary metrics, and recognise skew, spill, tiny files and GC pressure.
repartition shuffles to any count with even sizes; coalesce merges without a shuffle but only downwards. When to use each, and the coalesce(1) trap.
Expire the old version and insert the new one in a single Delta MERGE. The staged-union pattern, a PySpark version, the tests that catch broken history, and when to hand it to AUTO CDC.
One customer moves city. Four SCD types record it four different ways. See the rows each type produces, the SQL that writes them, and how to choose per column.
How each Spark join strategy moves data, the rules Spark uses to pick one, how AQE changes the choice at runtime, and when to step in with a hint.
cache and persist keep results but remember the lineage; checkpoint keeps only the result. Storage levels, when each pays off, and what to use on serverless.
Find the hot key behind a stage that never finishes, then fix it with AQE skew joins, key cleanup, hot-key isolation or salting, in that order.
How executor and driver memory is actually divided, why tasks spill, and how to diagnose and fix each kind of out-of-memory error instead of just adding RAM.
The three concepts that make Spark Structured Streaming behave predictably — explained with the failure modes you hit when you skip them.
Delta tables didn't make dimensional modeling obsolete. Here's how to pick the grain, split facts from dimensions, and build a star schema on Databricks that analysts can trust.
Identity columns, hash keys and ROW_NUMBER sequences all produce surrogate keys on Delta Lake. They differ on concurrency, collisions, reproducibility and join cost. Here's how to choose.
A test pyramid that actually fits a Spark pipeline — fast unit tests for transform logic, a shared local SparkSession, and a pattern for Delta-backed integration tests.
Build bronze, silver and gold on Databricks with Auto Loader, MERGE and liquid clustering, plus the mistakes that break it in production.
Build bronze, silver and gold in one Fabric lakehouse with schemas and materialized lake views, plus the gotchas that hit in production.
How Unity Catalog organizes data on Databricks: metastore, catalogs, schemas, tables and volumes, with the SQL to set each one up.
Why MERGE quietly rewrites far more data than it changes, and the three fixes that keep it fast: prune the target, deduplicate the source, compact after.
Adaptive Query Execution merges tiny post-shuffle partitions at runtime, so stop hand-tuning spark.sql.shuffle.partitions for every job.
dbt snapshots give you SCD Type 2 history in about ten lines of config — if you pick the right strategy and understand what they can't do.
Delta's mergeSchema option does nothing for MERGE statements — automatic schema evolution for MERGE is a separate session setting.
Four window patterns cover almost every pipeline need: latest-row dedupe, sessionization, running totals and gap detection — with the performance traps of each.
Tumbling windows are stateful — they backfill, retry per window and expose window start/end. Schedule triggers just fire and forget.
Sensors burn worker slots to poll for things that could simply announce themselves. Datasets, deferrable operators and event-driven triggers do it better.
The five levers that actually move a Databricks bill: job clusters over all-purpose, right-sized autoscaling, spot instances, photon where it pays, and killing idle time.
One pipeline definition, three environments: global parameters, parameterized linked services and a metadata table — instead of dev/test/prod copy-paste.
Nothing here yet — more content is on the way.