Deloitte Interview Questions
Z ordering (also called Z order clustering) is a data layout optimization technique in Delta Lake that collocates related data in the same set of files,...
What is Z-ordering in Spark?
Z ordering (also called Z order clustering) is a data layout optimization technique in Delta Lake that collocates related data in the same set of files, dramatically reducing the amount of data read for selective queries. How it works: Z ordering uses a space filling curve to map multi dimensional data into a single dimension while preserving locality. Records with similar values in the Z ordered columns are stored physically close together in the same files. Or in PySpark: Benefits: Queries fil
Explain the difference between Spark SQL and PySpark DataFrame APIs.
Both execute on the same Spark engine with the same Catalyst optimizer, but differ in syntax and use case: Spark SQL: Write queries as SQL strings Familiar to analysts who know SQL Register DataFrames as temp views first PySpark DataFrame API: Programmatic, chainable method calls Type hints, IDE autocomplete, easier refactoring Better for dynamic query construction Key similarities: Both produce the same execution plan (Catalyst optimizer processes both) Same performance for equivalent queries I
How do you implement incremental load in ADF?
Incremental load in Azure Data Factory copies only new or modified records since the last run, rather than reloading the full dataset. Method 1: Watermark based incremental load 1. Store the last successful load timestamp in a control table (Azure SQL) 2. ADF pipeline reads the watermark, queries source for records newer than watermark, loads them, then updates the watermark ADF pipeline steps: 1. Lookup Activity — get last watermark from control table 2. Copy Activity — copy data using watermar
How do you handle large-scale data ingestion into ADLS?
Azure Data Lake Storage (ADLS Gen2) ingestion at scale requires careful design across parallelism, partitioning, and reliability. Ingestion patterns: 1. ADF parallel copy with partitioning: For database sources, use physical/logical partitioning in ADF Copy Activity to parallelize reads. 2. Event Hubs / Kafka → Stream Analytics / Databricks → ADLS: For streaming ingestion, use micro batch writes (5 10 min intervals) to avoid small file proliferation. 3. Databricks Auto Loader: Scalable increment
Write Python code to split a name column into first name and last name.
Output: Handle missing last names: In PySpark: Using regex for complex names (e.g., 'Dr. John Smith III'):
What are fact and dimension tables in data modeling?
Star schema — the foundational data modeling pattern for analytical workloads — uses two types of tables: Fact Table: Stores quantitative, measurable events (transactions, clicks, orders, sensor readings) Each row = one business event Contains: foreign keys to dimensions + measures (numeric values like amount, quantity, duration) High row count (millions to billions) Example: fact sales(sale id, date key, customer key, product key, store key, quantity, amount) Dimension Table: Stores descriptive
How do you design and implement data pipelines using Azure Data Factory?
ADF is Azure's cloud ETL service for orchestrating data movement and transformation. Core ADF components: Pipelines — workflow containers for activities Activities — individual steps: Copy, Data Flow, Lookup, ForEach, If Condition, Stored Procedure Datasets — define data structure and location Linked Services — connection definitions (Azure SQL, ADLS, Blob, REST APIs) Triggers — Schedule, Tumbling Window, Event, Manual Integration Runtime — compute for data movement (Azure IR, Self hosted IR for
Explain the concept of PolyBase in Azure SQL Data Warehouse.
PolyBase is a technology in Microsoft SQL Server and Azure Synapse Analytics that allows you to query external data (stored in ADLS, Azure Blob, Hadoop) using standard T SQL, without moving the data into the database. How PolyBase works: 1. Define an External Data Source (ADLS, Blob, Hadoop) 2. Define an External File Format (Parquet, CSV, ORC) 3. Create an External Table pointing to the external data 4. Query the external table with T SQL — PolyBase pushes compute to the data source PolyBase fo