EXL Interview Questions
SparkContext and SparkSession are the two primary entry points into Apache Spark, each representing different generations of the Spark API. SparkContext...
Explain the purpose of SparkContext and SparkSession.
SparkContext and SparkSession are the two primary entry points into Apache Spark, each representing different generations of the Spark API. SparkContext (Spark 1.x era) The original entry point to Spark functionality Represents a connection to a Spark cluster and is used to create RDDs (Resilient Distributed Datasets) One SparkContext per JVM process Used for low level RDD operations SparkSession (Spark 2.0+, recommended) Unified entry point that encompasses SparkContext, SQLContext, HiveContext
How do you handle incremental load in PySpark when the table lacks a last_modified column?
When a source table has no last modified or updated at timestamp, standard watermark based incremental loads are not possible. Alternative strategies: 1. Row Hash Comparison (detect any column change) 2. Database CDC / Change Data Capture Use source database CDC features (SQL Server CDC, Oracle LogMiner, Debezium) Stream change events via Kafka into Spark Structured Streaming No modification to source table schema required 3. Full Load with Upsert (SCD Type 1) 4. Partition Based Incremental Load
How do you use Azure Stream Analytics for real-time data processing?
Azure Stream Analytics (ASA) is a fully managed, serverless real time analytics service that processes streaming data using a SQL like query language. Architecture: Creating a Stream Analytics Job: 1. Create a Stream Analytics job in Azure portal 2. Add Input (e.g., Event Hub with JSON serialization) 3. Write query in Stream Analytics Query Language (SAQL) 4. Add Output (e.g., ADLS Gen2, Power BI) 5. Start the job Example queries: Tumbling Window — aggregate every 5 minutes: Sliding Window — ale
What are the security features available in ADLS (e.g., Access Control Lists, Role-Based Access Control)?
ADLS Gen2 provides a layered security model combining Azure RBAC, POSIX ACLs, network controls, and encryption. 1. Azure Role Based Access Control (RBAC) Coarse grained access control at the storage account or container level Common built in roles: Storage Blob Data Owner — full read/write/delete + ACL management Storage Blob Data Contributor — read/write/delete, cannot change ACLs Storage Blob Data Reader — read only Assigned to users, groups, service principals, or Managed Identities Use RBAC
Write a SQL query to remove duplicate rows from a table.
Here are several approaches to remove duplicate rows from a SQL table, depending on the database system: Setup: Approach 1: CTE with ROW NUMBER() (most reliable, all databases) Approach 2: Using a temp table (safe approach) Approach 3: PostgreSQL — using ctid (internal row identifier) Approach 4: MySQL — self join Best practice: Always run a SELECT version first to verify which rows will be deleted, then run DELETE . Use the CTE with ROW NUMBER() approach as it works across most modern databases
How do you manage data lifecycle policies in ADLS?
Data lifecycle management in ADLS Gen2 automates the tiering and deletion of data based on rules, reducing storage costs as data ages. Lifecycle Management Policy Structure: Policies are JSON rules applied at the storage account level. Each rule specifies: Filters : which blobs/paths the rule applies to Actions : what to do (tier transition or delete) and when Configuring via Azure Portal: 1. Storage Account → Data Management → Lifecycle Management 2. Add rule → Set filters (prefix, blob type) a
What are the key considerations for designing a scalable data architecture in Azure?
A scalable Azure data architecture must balance performance, cost, reliability, and security. Key considerations: 1. Layered Architecture (Medallion / Lambda) Bronze (Raw) : Land data as is from sources — no transformations Silver (Curated) : Cleaned, deduplicated, joined data Gold (Aggregated) : Business ready aggregates and metrics Use Delta Lake throughout for ACID guarantees and time travel 2. Right Service for the Right Workload Batch ETL : ADF orchestration + Databricks/Synapse for transfo
How do you integrate Azure Key Vault with other Azure services?
Azure Key Vault integrates with Azure services through Managed Identities , Azure RBAC , and native SDK/connector support. 1. Integration via Managed Identity (preferred — no stored credentials) 2. Azure Data Factory In Linked Service configuration, use Azure Key Vault linked service for passwords ADF's Managed Identity must have Key Vault Secrets User role on the Key Vault Secrets are fetched at pipeline runtime — never stored in ADF artifacts 3. Azure Databricks Create a secret scope backed by