Databricks Interview Questions — Practice Quiz with Real Questions
Reviewed by Mark Dickie · Last updated
Databricks is a unified data analytics platform built on Apache Spark that combines data engineering, data science, and SQL analytics in a single cloud workspace. For an interview, you should be solid on Delta Lake internals (ACID commits, OPTIMIZE, ZORDER, time travel), PySpark DataFrame operations and the Catalyst optimizer, cluster sizing and autoscaling trade-offs, Unity Catalog governance, and the medallion architecture (bronze/silver/gold layers). You should also be comfortable with Delta Live Tables, MLflow tracking, and how the Photon execution engine changes query performance compared with standard Spark SQL. Knowing when to use Delta Cache, liquid clustering versus ZORDER, and serverless SQL warehouses versus all-purpose clusters will set you apart from candidates who only know the basics. The quiz below covers these areas at difficulty levels from fundamentals to advanced internals.
What does a Databricks interview typically test?
Most Databricks interviews split into four areas: data engineering with PySpark and Delta Lake, platform and cluster management, governance with Unity Catalog, and ML/GenAI with MLflow. Here is a breakdown of common topics by weight:
| Area | Common Questions | Difficulty Range |
|---|---|---|
| Delta Lake & Delta format | ACID guarantees, OPTIMIZE, VACUUM, time travel, liquid clustering | 2–5 |
| PySpark & Spark SQL | DataFrame API vs SQL, Catalyst optimizer, joins, UDFs, broadcast vs shuffle | 2–4 |
| Cluster management | All-purpose vs job clusters, autoscaling, photon, instance profiles | 2–4 |
| Unity Catalog | Catalog hierarchy, GRANT statements, dynamic views, row/column filters | 3–5 |
| MLflow & ML | Experiment tracking, model registry, feature engineering with Feature Store | 3–5 |
How should I prepare for Databricks interview questions?
- Write and run real PySpark code on a Databricks workspace or local Spark install; reading the docs is not enough for coding rounds.
- Practice Delta Lake operations end to end: create a Delta table, run OPTIMIZE and VACUUM, query older versions with time travel, and compare file sizes before and after compaction.
- Review Unity Catalog object hierarchy (metastore → catalog → schema → table) and write GRANT/REVOKE statements until they come from memory.
- Build a small Delta Live Tables pipeline and understand how declarative pipelines differ from notebook-based orchestration.
- Track a model with MLflow in a notebook, register it, and load it back for inference so you can answer MLflow questions with hands-on context.
What are the most common mistakes in Databricks interviews?
Candidates often confuse Delta Lake features with plain Parquet, mix up all-purpose and job clusters, or claim that ZORDER and liquid clustering are interchangeable. Others hand-wave the Catalyst optimizer without being able to name its phases (analysis, logical optimization, physical planning, code generation). Being specific about these details is what separates a passing answer from a vague one.
Key facts
- Tarmac has 99 Databricks interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
- Tarmac last reviewed these Databricks interview questions on 31 August 2026.
At a glance
| Questions | 25 shown · 99 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Multiple choice, Flashcard, Fill in the blank, True / false, Ordering, Multiple answer, Short answer, Code output, Find the bug |
What you'll review
- lakehouse vs warehouse vs lake
- dbu cost model
- cluster autoscaling
- job vs allpurpose clusters
- three level namespace
- optimize vacuum
- medallion architecture
- lakeflow jobs orchestration
- acid transactions
- structured streaming
- mlflow lifecycle
Practice questions
Databricks/lakehouse-architecture/lakehouse-vs-warehouse-vs-lake
What problem does the Databricks lakehouse architecture most fundamentally solve?#
Options
Show answer
The Databricks lakehouse architecture unifies a low-cost object-storage data lake with the ACID transactions, schema enforcement, and governance normally associated with a data warehouse, in one system, removing the need to maintain a separate copy of the data in each. Delta Lake provides that transactional layer directly on top of cheap object storage, so a single copy of the data serves BI, data engineering, and ML workloads instead of a lake feeding a separate warehouse copy.
The traditional pattern was two-tier: a cheap data lake (object storage, any file format) held raw data, and a separate data warehouse held a curated copy for BI, because only the warehouse offered ACID transactions, schema enforcement, and fast SQL. That split meant paying to store and pipeline the same data twice, and the copies could drift out of sync. Databricks' lakehouse architecture uses Delta Lake as a transactional storage layer directly on top of cheap object storage (S3/ADLS/GCS), so a single copy of the data gets warehouse-grade ACID guarantees, schema enforcement, and governance (via Unity Catalog) while remaining open Parquet files usable by any engine — which is why it's pitched as 'one copy of data, many workloads' (BI, data engineering, ML) rather than a lake feeding a warehouse.
Databricks/compute-clusters/dbu-cost-model
What is a DBU (Databricks Unit)?#
Show answer
A Databricks Unit is a normalized unit of processing capability, billed per hour of use, that measures how much compute a workload consumes on the Databricks platform. The DBU rate charged depends on both the cloud VM instance type/size backing the compute and the workload type — jobs compute is billed at a lower DBU rate than all-purpose/interactive compute for an equivalent instance, and serverless SQL warehouses have their own separate rate — so the Databricks-platform portion of the bill is DBUs consumed multiplied by the applicable DBU rate, on top of the underlying cloud provider's own infrastructure charge for the VMs themselves.
DBUs are the lever that makes cluster-type choice a real cost decision rather than just an operational one: the same instance type costs a different DBU rate depending on whether it's running as all-purpose, jobs, or SQL warehouse compute, which is why teams deliberately route scheduled production workloads to the cheaper job-cluster or serverless-SQL rate instead of leaving them on a shared interactive cluster.
Databricks/compute-clusters/cluster-autoscaling
In Databricks, what is the primary purpose of cluster autoscaling?#
Options
Show answer
Databricks cluster autoscaling automatically adds or removes worker nodes based on the cluster's workload. It scales up when there is more work to do and scales down when nodes are idle, removing the need to manually choose a fixed cluster size.
Cluster autoscaling in Databricks dynamically adjusts the number of worker nodes in a cluster — scaling up when demand increases and scaling down when nodes are underutilized — so you do not have to manually pick a fixed cluster size.
Databricks/compute-clusters/job-vs-allpurpose-clusters
When a Databricks job run finishes, its job cluster is automatically terminated. In contrast, _____ clusters remain running until they are manually terminated or hit an idle autotermination threshold.#
Show answer
When a Databricks job run finishes, its job cluster is automatically terminated. In contrast, all-purpose clusters remain running until they are manually terminated or hit an idle autotermination threshold.
Job clusters are ephemeral — Databricks creates them for a specific job run and terminates them when the run completes. All-purpose (interactive) clusters, by contrast, stay alive after work finishes so users can continue interacting with notebooks; they stop only when manually terminated or after the configured idle autotermination period elapses.
Databricks/compute-clusters/job-vs-allpurpose-clusters
On Databricks, _____ clusters incur a higher per-DBU (Databricks Unit) rate than job clusters because they are designed for interactive, multi-user notebook workloads rather than automated job execution.#
Show answer
On Databricks, all-purpose clusters incur a higher per-DBU (Databricks Unit) rate than job clusters because they are designed for interactive, multi-user notebook workloads rather than automated job execution.
Databricks pricing distinguishes between all-purpose and job DBU rates. All-purpose clusters are priced at a higher per-DBU rate because they support interactive, multi-user sessions. Job clusters are priced lower per DBU since they serve single-owner automated workloads and terminate when the job finishes.
Databricks/unity-catalog/three-level-namespace
In Unity Catalog, a fully qualified table reference looks like catalog.schema.table (e.g. main.sales.orders). What does the catalog level represent in this hierarchy?#
Options
Show answer
In Unity Catalog's catalog.schema.table hierarchy, the catalog is the top-level container for a group of schemas, commonly used to separate environments such as dev/staging/prod or distinct business units, sitting directly under the metastore and above schemas, which in turn contain the actual tables, views, volumes, and models. That structure lets the same schema name exist independently in two different catalogs, such as dev and prod, without colliding, and lets grants and lineage apply consistently at any of the three levels.
Unity Catalog's object hierarchy is metastore → catalog → schema → tables/views/volumes/models/functions. The catalog is the first layer of organization beneath the metastore and is the natural place to draw a hard isolation boundary — most commonly one catalog per environment (dev/staging/prod) or per business domain — with schemas nested inside a catalog grouping related tables the way a database groups tables in a traditional RDBMS. That three-level catalog.schema.table naming is what lets Unity Catalog apply consistent grants, lineage, and audit logging at any of the three levels, and lets the same schema name (e.g. sales) exist independently in both the dev and prod catalogs without colliding.
Databricks/delta-lake-performance/optimize-vacuum
By default, Delta Lake's VACUUM command only removes data files that are no longer referenced by the current table version and are older than a 7-day retention threshold.#
Options
Show answer
True. Delta Lake's VACUUM command defaults to a 7-day (168-hour) retention threshold, set by the delta.deletedFileRetentionDuration table property, and a built-in safety check blocks running VACUUM with a shorter interval unless that check is explicitly disabled. The default exists because old files can still be needed by a concurrent reader, an in-flight time-travel query, or a streaming job that hasn't caught up yet.
True. The default value of the delta.deletedFileRetentionDuration table property is 'interval 7 days' (168 hours), and Delta Lake's built-in retention-duration check actively blocks a VACUUM call from using a shorter interval unless that safety check is explicitly disabled. That default exists because old files can still be needed by a concurrent long-running reader, a still-in-flight time-travel query, or a streaming job that hasn't caught up yet — vacuuming too aggressively can pull the floor out from under any of those.
Databricks/lakehouse-architecture/medallion-architecture
Order the stages data moves through in a typical medallion-architecture lakehouse pipeline, from source to consumption.#
Put these in order
Show answer
A medallion-architecture pipeline flows from the source system, into bronze (ingested as-is, preserving fidelity for reprocessing), into silver (cleaned, deduplicated, and conformed), into gold (aggregated for a specific consumer), and finally to consumption by BI dashboards or ML models reading the gold layer. Cleaning happens in silver rather than during ingestion so bronze stays a faithful, reprocessable copy of the source, and gold is only built from already-validated silver data rather than raw bronze.
Data has to exist in a source system before anything ingests it, so source comes first. Bronze ingests it with as little transformation as possible specifically so it can be reprocessed later without re-hitting the source, which is why cleaning and deduplication happen one stage later, in silver, not during initial ingestion. Gold only makes sense once silver has already conformed and validated the data — aggregating raw, unvalidated bronze records straight into gold would bake in whatever data-quality problems silver exists to catch. Consumption comes last because BI tools and ML training are built to read the already-aggregated, read-optimized gold layer, not to repeat gold's aggregation logic themselves.
Databricks/orchestration-streaming-ml/lakeflow-jobs-orchestration
Order the lifecycle of a single scheduled Databricks Workflows / Lakeflow Jobs run, from trigger to review.#
Put these in order
Show answer
A scheduled Databricks Workflows (Lakeflow Jobs) run proceeds from trigger, to provisioning a fresh ephemeral job cluster, to executing tasks in the order set by the job's dependency graph, to the cluster terminating automatically once every task finishes, and finally to the run's status, logs, and per-task results becoming available in run history. The cluster can't terminate before every task completes, and run history can only reflect what happened during execution, which is why those two steps come last.
Nothing happens until something starts the run, so a trigger has to come first. Because a job cluster is ephemeral rather than already running, provisioning happens next, before any task can execute. Tasks then run according to the job's dependency graph — a downstream task can't start before the upstream task it depends on finishes. Only once every task in the DAG has completed does the cluster have nothing left to do, which is when it terminates automatically to stop accruing DBU cost. Run history, logs, and alerting are populated from what happened during execution, so they're only available to review after the run — and its cluster — are done.
Databricks/compute-clusters/cluster-autoscaling
Which of the following statements about Databricks cluster autoscaling are correct? (Select all that apply.)#
Options
Pick every one that applies.
Show answer
Autoscaling in Databricks requires specifying both a minimum and a maximum number of worker nodes, and it is available for both all-purpose and job clusters. A cluster cannot scale down to zero worker nodes because the minimum must be at least one. Databricks does not offer a single autoscaling mode identical across all cloud providers and cluster types; modes and behavior vary by platform.
Autoscaling in Databricks requires you to set both a minimum and maximum worker count, and it is supported on both all-purpose and job clusters — so options a and b are correct. The minimum worker count must be at least 1, so a cluster cannot scale down to zero nodes; option c is wrong. Databricks does not offer a single universal autoscaling mode — available modes and their behavior differ by cloud provider and cluster type, so option d is also wrong.
Databricks/compute-clusters/dbu-cost-model
What is a Databricks Unit (DBU) and how does it factor into cluster cost calculations?#
Show answer
A Databricks Unit (DBU) is a unit of processing capability per hour, billed based on VM instance type and Databricks runtime. It measures how much of the Databricks platform you consume, and your total cost = DBU rate for the instance type × hours used × applicable price multiplier (e.g., Photon, All-Purpose vs Jobs).
A DBU is the fundamental billing unit for Databricks compute. The total compute cost is driven by the instance type's DBU rate, the number of hours the cluster runs, and the workload-specific pricing tier (All-Purpose, Jobs, Photon, etc.). Cloud infrastructure costs (the underlying VMs) are billed separately by the cloud provider.
Databricks/delta-lake-core/acid-transactions
Which of these are genuine capabilities Delta Lake adds on top of plain Parquet files sitting in object storage? Select all that apply.#
Options
Pick every one that applies.
Show answer
Delta Lake's genuine capabilities on top of plain Parquet include ACID transactions backed by a transaction log that records every commit, time travel via VERSION AS OF or TIMESTAMP AS OF bounded by file retention, and schema enforcement plus optional schema evolution for compatible new columns. It does not convert files into a proprietary binary format — the underlying files remain open Parquet, readable by any engine with a Delta connector — and it provides no automatic row-uniqueness guarantee; duplicates require an explicit MERGE upsert or constraint to prevent.
Delta Lake's actual mechanism is a transaction log of JSON/Parquet commit entries layered over standard Parquet data files: that log is what gives ACID transactions (a), lets you time-travel to a prior committed version (b), and lets the engine check incoming writes against the recorded schema, either enforcing it strictly or evolving it when explicitly allowed (c). It is not a proprietary binary format — the underlying files are still open Parquet, and Delta Lake is an open-source, Linux Foundation project readable by any engine with a Delta connector, so (d) is a common but false 'vendor lock-in' misconception. And Delta Lake has no automatic row-uniqueness guarantee (e): duplicates are entirely possible unless a pipeline explicitly enforces them with a MERGE upsert or a check constraint — there's no implicit primary key.
Databricks/compute-clusters/job-vs-allpurpose-clusters
A team is deciding between an all-purpose cluster and a job cluster for a nightly scheduled ETL pipeline. Which of these are accurate? Select all that apply.#
Options
Pick every one that applies.
Show answer
For a nightly ETL pipeline, a job cluster is created automatically when the run starts and terminates automatically when it finishes, so there's no idle billing between runs, and job clusters use optimized autoscaling that can scale down after roughly 40 seconds of underutilization — more aggressive than the idle timeout typical of all-purpose clusters, which stay running and shared for interactive notebook work until manually stopped. An all-purpose cluster is actually billed at a higher DBU rate than a job cluster for the same workload, not a lower one, and job clusters can run notebook tasks just as well as wheel or JAR tasks.
Job clusters exist for the lifetime of one job run: they spin up automatically when the run starts, so there's no pre-provisioning idle cost, and they terminate automatically the moment the run finishes (a); Databricks' optimized autoscaling used by job clusters can shrink the cluster after around 40 seconds of underutilization, a much shorter window than the interactive idle timeouts typical of all-purpose clusters (b), which are intentionally kept up and shared for exploratory notebook work by multiple users until someone stops them or the idle timeout fires (d). The DBU rate runs the other way from (c): jobs compute is billed at a lower rate than all-purpose compute for equivalent instance types, precisely because all-purpose adds interactive/collaboration overhead — so all-purpose being cheaper is a real but false assumption teams sometimes make. And (e) is false: a job task can absolutely run a notebook on a job cluster; notebook tasks are one of the most common task types in Databricks Workflows/Lakeflow Jobs.
Databricks/orchestration-streaming-ml/structured-streaming
When a Structured Streaming query on Databricks is started without an explicit .trigger(...), Spark processes data using low-latency, continuous, record-at-a-time processing rather than micro-batches.#
Options
Show answer
False. A Structured Streaming query started without an explicit trigger uses the default micro-batch mode, running the next micro-batch as soon as the previous one finishes — it does not process records one at a time. Continuous, record-at-a-time processing is a separate, more restrictive mode you must opt into explicitly with .trigger(continuous = "1 second"), and it supports only a limited subset of operations.
False. The default trigger behavior is micro-batch processing: Spark runs the next micro-batch as soon as the previous one finishes, but it is still batching records together, not handling them one at a time. Continuous, record-at-a-time processing is a distinct execution mode you have to opt into explicitly with .trigger(continuous = "1 second"), and it's far more restrictive — it supports only a limited subset of operations (no most aggregations, for example) and remains an experimental mode, so the overwhelming majority of Structured Streaming pipelines, including everything running with .trigger(availableNow = True) for incremental batch-style ingestion, run on the default micro-batch engine.
Databricks/lakehouse-architecture/medallion-architecture
Explain the medallion architecture (bronze/silver/gold) commonly used in Databricks lakehouse pipelines, and what each layer is responsible for.#
Show answer
Bronze holds raw data ingested from source systems essentially as-is — same shape as the source, often with a few ingestion-metadata columns added (load timestamp, source file) — so the pipeline preserves a faithful, reprocessable copy without hitting the source system again if downstream logic needs to change. Silver applies cleaning, validation, deduplication, type-casting, and joins across sources, turning bronze's raw records into a conformed, queryable representation of the business entities. Gold aggregates silver into business-level, often denormalized tables shaped for a specific consumption pattern — a BI dashboard, a reporting mart, or features for an ML model — optimized for read performance rather than flexibility. Layering it this way isolates each stage's contract: a bug in the cleaning logic can be fixed and silver/gold rebuilt from bronze without re-extracting from the source, and each layer's consumers know exactly what quality/shape guarantee they're getting.
The medallion architecture is a data-quality staging convention, not a Databricks-specific feature — bronze preserves raw source fidelity for reprocessability, silver conforms and cleans it into a trustworthy shared representation, and gold shapes it for a specific consumer (BI, ML features, a reporting mart). The reason it matters in interviews and on the job alike: without the layering, a schema change or a bad transformation upstream forces a full re-extraction from the source system to fix, and there's no clean boundary for who owns what quality guarantee. With bronze preserved, silver and gold can always be rebuilt from data already sitting in the lakehouse.
Databricks/orchestration-streaming-ml/mlflow-lifecycle
What is MLflow, and what do its core components do in the Databricks ML lifecycle?#
Show answer
MLflow is an open-source platform for managing the end-to-end machine learning lifecycle. Its core pieces: Tracking logs parameters, metrics, and artifacts for every training run so experiments are comparable and reproducible; the packaged Model format lets a trained model be deployed consistently across different serving targets; and the Model Registry — on Databricks, now typically 'Models in Unity Catalog' — versions a model, manages its lifecycle stage, and applies Unity Catalog governance (access control, lineage) to model artifacts the same way it governs tables. MLflow 3 extended this with production-grade tracing, evaluation, and prompt management aimed at GenAI/agent workloads, not just traditional training runs.
MLflow's value is giving every stage of the ML lifecycle — experimentation, packaging, and deployment governance — a consistent, tool-agnostic interface, so a model trained by one engineer can be evaluated, versioned, and promoted by someone else without reverse-engineering how it was built. Registering models in Unity Catalog rather than the legacy workspace-scoped registry is the current recommended path specifically because it puts model artifacts under the same access-control and lineage machinery as the tables that fed them, closing a governance gap that used to exist between data and models.
Databricks/compute-clusters/cluster-autoscaling
On Databricks, enhanced autoscaling (available on AWS and GCP) scales up worker count in progressively larger steps (e.g., 1 → 2 → 4 → 8 nodes) and scales down by removing one worker node at a time.#
Options
Show answer
True. Enhanced autoscaling on Databricks (AWS and GCP) adds worker nodes in increasingly larger steps—1, 2, 4, 8, and so on—to ramp up fast under load, and it scales down by removing only one node at a time to avoid prematurely dropping capacity. Standard autoscaling on Azure does not use this stepped approach.
Enhanced autoscaling is designed to react quickly to increased load by adding nodes in exponentially growing steps, while it scales down conservatively—removing one node at a time—to avoid prematurely shedding capacity that may still be needed. Standard autoscaling (Azure) behaves differently and more gradually in both directions.
Databricks/compute-clusters/dbu-cost-model
A Databricks cluster's DBU consumption is calculated from the driver node DBUs, each worker node's DBUs, the cluster runtime in hours, and a Photon multiplier applied when Photon acceleration is enabled. The total DBUs are then multiplied by the per-DBU price to get the cost in USD.#
def compute_dbu_cost(dbu_rate_per_hour, num_workers, driver_dbus, worker_dbus, hours, photon_multiplier=1.0):
driver_total = driver_dbus * hours * photon_multiplier
workers_total = worker_dbus * num_workers * hours * photon_multiplier
total_dbus = driver_total + workers_total
return round(total_dbus * dbu_rate_per_hour, 2)
print(compute_dbu_cost(0.55, 4, 1.5, 2.0, 7, 1.3))Show answer
47.55
Driver DBUs = 1.5 × 7 × 1.3 = 13.65. Worker DBUs = 2.0 × 4 × 7 × 1.3 = 72.8. Total DBUs = 13.65 + 72.8 = 86.45. Cost = 86.45 × $0.55/DBU = 47.5475, which rounds to 47.55. The Photon multiplier of 1.3 is applied to both driver and worker DBU consumption before multiplying by the per-DBU rate.
Databricks/compute-clusters/dbu-cost-model
Databricks charges different per-DBU rates depending on the compute type: All-Purpose Compute (interactive notebooks) costs more per DBU than Jobs Compute (scheduled job runs). For the same cluster shape and runtime, the function below computes the total cost under each pricing model and returns the difference.#
def compare_cluster_costs(ap_dbu_rate, job_dbu_rate, dbus_per_hour, hours, num_workers, driver_dbu=1.0):
total_dbus = (driver_dbu + dbus_per_hour * num_workers) * hours
ap_cost = round(total_dbus * ap_dbu_rate, 2)
job_cost = round(total_dbus * job_dbu_rate, 2)
return round(ap_cost - job_cost, 2)
print(compare_cluster_costs(0.55, 0.15, 1.5, 8, 4))Show answer
22.4
Total DBUs = (1.0 + 1.5 × 4) × 8 = 7.0 × 8 = 56.0. All-Purpose cost = 56.0 × $0.55 = $30.80. Jobs Compute cost = 56.0 × $0.15 = $8.40. Difference = $30.80 − $8.40 = $22.40. This illustrates the cost premium of running interactive All-Purpose Compute versus scheduling the same workload as a job, which is a key Databricks cost-optimization decision.
Databricks/orchestration-streaming-ml/structured-streaming
This Auto Loader ingestion pipeline runs on a job cluster that's provisioned fresh for every scheduled run and terminates when the run finishes. After a few days, the team notices the bronze table has far more rows than the source files justify. Which line is the root cause?#
1| (spark.readStream
2| .format("cloudFiles")
3| .option("cloudFiles.format", "json")
4| .load(raw_path)
5| .writeStream
6| .option("checkpointLocation", "/tmp/checkpoints/bronze_orders")
7| .trigger(availableNow=True)
8| .toTable("bronze.orders"))Options
Show answer
Line 6 — /tmp is local, ephemeral storage on the cluster's own disk, not persistent cloud storage; since a fresh job cluster is provisioned on every run, the checkpoint recording which files were already ingested is gone by the next run, so Auto Loader reprocesses and re-appends files it already ingested
A checkpoint has to persist across runs to do its job: it's how Auto Loader (and Structured Streaming generally) tracks which source files it has already processed, so a restart resumes instead of starting over. /tmp on a Databricks cluster is local disk on that specific VM, and since this pipeline runs on a job cluster that's provisioned fresh and torn down every run, that local checkpoint directory never survives to the next run — every run looks like the first run ever, so every previously-ingested file gets read and appended to bronze.orders again, silently duplicating rows. The fix is a checkpoint location on durable cloud storage the next run's cluster can also see (a DBFS/Unity Catalog volume path or a cloud storage URI), not local disk. .trigger(availableNow=True) is valid and simply means 'process everything currently available, then stop' (b is wrong), cloudFiles (Auto Loader) is the correct, current API for incremental file ingestion including JSON (c is wrong), and checkpointing is required for exactly-once source tracking on any streaming read, aggregating or not (d is wrong).
Databricks/compute-clusters/job-vs-allpurpose-clusters
A senior engineer reviews a pipeline where every nightly ETL job runs against a shared, always-on all-purpose cluster instead of a dedicated job cluster. What's the cost/reliability case for switching those jobs to job clusters, and what does the team give up by doing so?#
Show answer
Job clusters bill at the lower jobs-compute DBU rate and terminate automatically the moment a run finishes, so there's no idle-time cost between nightly runs the way there is on an always-on shared cluster. They also isolate each job's environment and resource usage: a runaway job, a library version conflict, or one job monopolizing cluster memory on the shared all-purpose cluster can't degrade or crash other teams' interactive notebook sessions or other jobs sharing it, and a bad restart of one job doesn't require touching a cluster other people are actively using. The tradeoff: a job cluster pays a cold-start provisioning delay (typically a few minutes) on every single run since it isn't already warm, whereas the always-on cluster starts instantly; running many small, frequent jobs each on their own job cluster also loses the resource-sharing efficiency of one shared cluster and adds per-cluster management overhead, and interactively debugging a specific run is harder once its ephemeral cluster has already terminated.
The core argument for job clusters is cost and blast-radius isolation: they bill at a lower DBU rate, terminate automatically so there's no idle spend, and one job's failure or resource spike can't take down other people's work on a shared always-on cluster. What's given up is start-up latency (a job cluster provisions from cold on every run, unlike an already-warm shared cluster) and some operational simplicity when many small jobs each spin up separately rather than sharing one cluster's resources — which is exactly the kind of tradeoff a senior engineer is expected to weigh explicitly rather than defaulting to 'always-on is simpler.'
Databricks/compute-clusters/cluster-autoscaling
Databricks Enhanced Autoscaling can safely remove worker nodes that still hold active shuffle data, whereas Standard Autoscaling cannot. What is the name of the mechanism that Enhanced Autoscaling uses to achieve this, and what does it do with the node's shuffle data before terminating the node?#
Show answer
Enhanced Autoscaling uses graceful decommissioning. When a worker is selected for removal, it is marked for decommission so it receives no new task assignments. Its shuffle blocks are then migrated to other worker nodes before the node is terminated, preventing shuffle data loss and avoiding stage recomputation.
Enhanced Autoscaling leverages Spark's graceful decommissioning feature. When the autoscaler selects a node for removal, it marks the executor for decommission, which prevents new tasks from being assigned. In-flight tasks are allowed to complete, and shuffle blocks are migrated to surviving executors before the node is actually terminated. Standard Autoscaling lacks this mechanism, so removing nodes that hold shuffle data causes those files to be lost, triggering expensive stage recomputation. This is why Enhanced Autoscaling can scale down more aggressively without risking data loss or job failures.
Databricks/delta-lake-performance/optimize-vacuum
A teammate's nightly backfill script runs a large MERGE into a Delta table, then immediately cleans up storage before a downstream reconciliation job reads an older version of the same table for a diff. That reconciliation query now fails intermittently with a 'file not found' error. Which line(s) are the actual problem?#
1| spark.conf.set("spark.databricks.delta.retentionDurationCheck.enabled", "false")
2| spark.sql("VACUUM prod.bronze.events RETAIN 0 HOURS")
3| spark.sql("SELECT * FROM prod.bronze.events VERSION AS OF 42").show()Options
Show answer
Lines 1–2 — disabling the retention-duration safety check and then running VACUUM with RETAIN 0 HOURS immediately deletes data files that older table versions still reference, so any concurrent reader (including the very next line's time-travel query, or a separate downstream job) can lose the files it needs mid-read; the 7-day default exists precisely to give concurrent operations a safety window
VACUUM deletes data files that are no longer part of the current table version, once they're older than the configured retention window — but older historical versions (and any query still reading them) depend on exactly those files staying in place until that window passes. Line 1 turns off Delta Lake's built-in guard against unsafe short retention, and line 2 then immediately deletes anything untracked by the current version, with zero grace period. That's why the downstream reconciliation query on line 3, reading version 42, starts intermittently throwing a file-not-found error: whether it fails depends on the race between when VACUUM runs and when that read happens. VERSION AS OF is valid syntax and VACUUM does accept RETAIN n HOURS, so (b) and (c) misdiagnose the syntax; and Databricks' own documentation is explicit that shortening the retention interval below the 7-day default is unsafe for exactly this reason, so (d) is false — VACUUM absolutely can, and does, remove files a concurrent reader or an old snapshot still needs once you disable the safety check.
Databricks/compute-clusters/dbu-cost-model
A teammate wrote the following function to estimate the Databricks DBU cost for a compute cluster running on spot instances. The function should compute total DBUs consumed and multiply by the applicable DBU dollar rate. The spot_infra_discount parameter represents the cloud provider's discount on spot instance infrastructure pricing (e.g., 0.6 for a 60% discount). Which option identifies the bug?#
def compute_dbu_cost(instance_dbu_rate, num_nodes, hours, dbu_dollar_rate, is_spot, spot_infra_discount):
# Total DBUs = per-node rate × all nodes (driver + workers) × hours
total_dbu = instance_dbu_rate * num_nodes * hours
# Apply spot savings to the DBU dollar rate
if is_spot:
dbu_dollar_rate = dbu_dollar_rate * (1 - spot_infra_discount)
return total_dbu * dbu_dollar_rateOptions
Show answer
The spot discount is applied to the DBU dollar rate — spot instances reduce only the cloud infrastructure cost, not the Databricks DBU rate
In the Databricks DBU cost model, the DBU dollar rate ($/DBU) is identical whether the underlying cloud instances are spot or on-demand. Spot instance savings come exclusively from the cloud provider's discounted infrastructure (VM) pricing — the per-DBU charge from Databricks does not change. The buggy line dbu_dollar_rate = dbu_dollar_rate * (1 - spot_infra_discount) incorrectly reduces the DBU dollar rate, which would understate the Databricks portion of the cost. The correct approach is to compute DBU cost at the full DBU rate and apply the spot discount only to the separate infrastructure cost line item. Option (a) is wrong because the driver node does consume DBUs. Option (c) is wrong because DBU rates are billed per hour (prorated per second), not solely per second. Option (d) is wrong because spot instances have no effect on DBU consumption or rate at all.
Databricks/delta-lake-core/acid-transactions
In Delta Lake's Optimistic Concurrency Control (OCC) protocol, a transaction goes through a well-defined sequence of phases from begin to commit. Arrange these phases in the correct chronological order.#
Put these in order
Show answer
Delta Lake's OCC protocol follows: (1) record the current table version as the read snapshot, (2) perform reads and writes while tracking file-level actions and read predicates, (3) check whether the starting version is still the latest, (4) run conflict resolution against any intervening commits if it is not, and (5) atomically commit the next version's JSON log file.
Delta Lake's OCC protocol begins by recording the current table version as the transaction's read snapshot (b). The transaction then performs its reads and writes, tracking file-level actions and read predicates for later conflict detection (c). Before committing, the transaction checks whether its starting version is still the latest (e). If a newer commit has landed, the transaction runs conflict resolution against the intervening commits to detect read-write or write-write conflicts (a). If no conflict is found — or there were no intervening commits — the transaction atomically commits its changes as the next version in the delta log (d).
Related interview questions
The other 74 questions
This page shows 25. A free account opens the rest and marks your answers, which a page of answers can't do. Miss one and it returns a few days later, then a week after that, until you stop missing it.
Free · the whole bank · 100 graded answers per 30 days · written feedback and job-ad quizzes on the paid plan