Capgemini Interview Questions
Data Lake Data Warehouse Schema Schema on read (applied at query time) Schema on write (enforced at load time) Data types Any — raw files, JSON, images,...
What are the main differences between Data Lake and Data Warehouse?
Data Lake Data Warehouse Schema Schema on read (applied at query time) Schema on write (enforced at load time) Data types Any — raw files, JSON, images, logs Structured data only Storage Cheap object storage (S3, ADLS) More expensive compute+storage Processing Flexible — Spark, Presto, ML SQL optimized Governance Harder to control (data swamp risk) Strong structure and governance Modern trend : Data Lakehouse (Delta Lake, Iceberg) combines both — cheap object storage + ACID transactions + SQL pe
How do you implement Slowly Changing Dimensions (SCD) in ETL?
SCD Type 1 — overwrite (no history): SCD Type 2 — track history with versioning: dbt snapshots (automated SCD Type 2): dbt handles the expire+insert logic automatically based on the source's updated at column.
Explain Delta Lake and its advantages over traditional data lakes.
Delta Lake is an open source table format that adds reliability features on top of Parquet files stored in object storage. Key advantages : ACID transactions : concurrent reads and writes are safe — no partial writes seen by readers Schema enforcement : rejects writes that violate the table schema Schema evolution : mergeSchema=true allows adding new columns without breaking existing readers Time travel : every write creates a versioned snapshot. Query any past version: DML support : UPDATE , DE
How do you optimize a PySpark job for performance?
Avoid wide shuffles : Use broadcast() for small dimension tables (< 200 MB) — eliminates shuffle entirely Repartition on join key before joining: df.repartition(200, "customer id") Reduce data volume early : Filter and project ( select ) as early as possible in the DAG Use partition pruning — filter on partition columns Partition tuning : Target 128 MB–1 GB per partition Tune spark.sql.shuffle.partitions (default 200 — often too many for small data) Use built in functions over UDFs : Cache wisel
Explain the concept of a Data Mesh and its benefits.
Data Mesh is an architectural approach that decentralizes data ownership — treating data as a product owned by domain teams rather than a centralized data engineering team. Four principles : 1. Domain ownership : each business domain (sales, marketing, logistics) owns and publishes their own data products 2. Data as a product : domain teams treat their datasets like products — SLAs, documentation, quality guarantees 3. Self serve infrastructure : a central platform team provides infrastructure t
How do you choose the right file format for a big data pipeline (Parquet vs ORC vs Avro)?
Format Storage Best For Parquet Columnar Analytics, BI queries, Spark/Presto/Athena ORC Columnar Hive heavy workloads, better Hive compression Avro Row based Kafka serialization, write heavy ingestion, schema evolution Rules : Analytical reads (aggregate many rows, few columns) → Parquet or ORC Streaming ingestion (write one record at a time, Kafka) → Avro Row by row processing (export to external systems) → Avro or CSV Parquet vs ORC : Parquet: wider ecosystem support (Spark, Presto, BigQuery,
What is the purpose of Z-ordering in Databricks Delta tables?
Z ordering is a multi dimensional clustering technique that co locates related rows across multiple columns in the same set of files. How it works : maps rows to file locations using a Z curve (space filling curve) so that rows with similar customer id AND date values end up in the same files. When you query: Delta Lake's data skipping reads only the files whose min/max statistics cover those values — massively fewer files scanned. vs single column partitioning : Partitioning works on one column
Explain how caching works in Spark and when to use it.
cache() / persist() : tells Spark to store the computed DataFrame/RDD in memory (or disk) after first evaluation, so it doesn't recompute from scratch on subsequent actions. Storage levels : MEMORY ONLY : fastest, evicts on OOM MEMORY AND DISK : spills to disk if memory full DISK ONLY : use when memory is very tight When to cache : DataFrame is used in multiple downstream actions Expensive recomputation (complex joins, large file reads) When NOT to cache : DataFrame used only once Very large Dat