Data TrailhouseSign inBook a free call
Menu
FREE · 20 QUESTIONS WITH ANSWERS

Databricks and PySpark interview questions

The Databricks and PySpark questions interviewers ask most, with short answers you can explain in your own words. Tap a question to see the answer.

01What is the lakehouse?

An architecture that combines data lake storage with warehouse features like ACID transactions and schema enforcement, using open formats like Delta.

02Driver vs executors?

The driver plans the job and coordinates tasks. Executors run the tasks on partitions of data.

03What is lazy evaluation?

Transformations build a plan and run only when an action like count, write or collect is called.

04Transformation vs action?

Transformations (select, filter, join) return a new DataFrame lazily. Actions (count, show, write) trigger execution.

05Narrow vs wide transformations?

Narrow ones work within a partition (filter, select). Wide ones need data from other partitions and cause a shuffle (groupBy, join).

06What is a shuffle and why is it expensive?

Moving data between executors over the network and disk. It is often the slowest part of a job.

07What is a broadcast join?

Sending a small table to every executor so the big table does not shuffle.

from pyspark.sql.functions import broadcast
df = big.join(broadcast(small), 'id')
08repartition vs coalesce?

repartition shuffles to any number of partitions. coalesce only reduces partitions without a full shuffle.

09What is data skew and how do you fix it?

One key has far more rows, so one task runs much longer. Fix with AQE skew handling, filtering NULL keys, or salting.

10What is Adaptive Query Execution?

Spark changes the plan at runtime: merges small partitions, switches join types and splits skewed partitions.

11What is Delta Lake?

A storage layer on Parquet that adds ACID transactions, time travel, MERGE and schema enforcement.

12How do you upsert into Delta?

With MERGE.

MERGE INTO silver.orders t USING updates s
ON t.order_id = s.order_id
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *;
13What do OPTIMIZE and VACUUM do?

OPTIMIZE compacts small files. VACUUM removes old files no longer needed (after the retention period).

14What is the medallion architecture?

Bronze (raw), silver (cleaned and conformed) and gold (business-ready) layers.

15What is Auto Loader?

Incremental file ingestion that detects new files in cloud storage and processes each file once.

16What is Unity Catalog?

Central governance for Databricks: catalogs, schemas, permissions, lineage and external locations across workspaces.

17Why avoid Python UDFs?

Each row moves between the JVM and Python, which is slow. Built-in functions run inside Spark's engine.

18cache vs persist?

cache keeps a DataFrame in memory (default level). persist lets you choose the storage level. Only cache data you reuse, and unpersist it.

19Job cluster vs all-purpose cluster?

Job clusters start for a job and stop after, which is cheaper. All-purpose clusters are for interactive work.

20How do you debug a slow job?

Open the Spark UI, find the longest stage, check spill and the gap between median and max task time, then fix skew, joins or file sizes.

Databricks and PySpark premium interview packs

50 real scenario questions per level, each with a model answer, code, a real project scenario, an interview tip and the likely follow-up. Download the free 5-question sample first.

Coming soon

The Databricks and PySpark intermediate pack is being prepared.

Save with packages

Bundles that include Databricks and PySpark. See all packages →

20% OFF

Azure Databricks Engineer Combo

Azure Databricks Engineer, both levels: Intermediate and Advanced.

Databricks
Price shown when the packs are live
25% OFF

Data Engineer Track

Everything a data engineering interview covers.

SQLPythonDatabricksAzure DEFabric
Price shown when the packs are live
BEST VALUE50% OFF

Complete Bundle

All 12 courses, both levels. 24 PDFs.

Price shown when the packs are live

Questions before you buy

How do I get the PDF?

Tap "Buy on WhatsApp". After payment I send you a private download link on WhatsApp, and you can download the file straight away.

How long does delivery take?

Usually within a few hours of payment, and always within 24 hours.

How do I pay?

I share the payment options on WhatsApp before you pay. Prices are in US dollars, and you can pay in your local currency at the day's rate.

Can I see a sample first?

Yes. Every premium pack has a free sample with the first 5 questions. Use the "Free sample" button on the pack.

Can I get a refund?

Because these are digital files, payments are not refundable once the file is sent. If a file does not open or something is missing, message me and I will fix it quickly.

🎤 Practise with a real mock interview

60 minutes live with Hikmat Ullah, plus written feedback. Bronze 20 USD (1 session), Silver 50 USD (3 sessions), Gold 80 USD (5 sessions).

See packages