📎 Referral Code: —
🎁 Referral Earnings ₹0 →
📊 Dashboard Sign In
🎁 ₹0
Your Referral Earnings → Tap to view
Buy
🛒
Buy Course
Videos
📘
Basic Videos
🚀
Project Related Videos
🐍
Old Videos Style — will be removed soon
📚
Buy Book
After Course Completion
📒
My Interview Tracker — HR calls & follow-ups
📈
My Performance — Track your progress
🎯
Interview Prep — Resume & questions for a job
🏢
Company Interview Questions — with answers
🤖
Central Command — your HQ bot
💼
Jobs — AWS Data Engineer openings
Personal Training
🎬
Live Classes
🎯
My 1:1 Dashboard
🗺️
Course Roadmap
🎤
Mock Interview
🧑‍💼
HR Discussion
🗓️
Slot Booking
📅
My Booked Slots
Passive Income
🎁
Refer & Earn — ₹1,000 per referral
🤝
Browse Job Support
💰
Become a Supporter
🔗
Browse Referrals
📢
Post a Referral
🎓
Course Marketplace — Other Trainers
🧑‍🏫
Teach a Course
📊
My Courses & Earnings
🎬
Reels
AI Tools
🌐
Project Explanation Agent
👤
My Profile
🏢
Recruiter Board
🛟
Support Works

← Stellantis interview questions

🎬No video for this question yet. The written answer is below.

job Optimization
  • Data skew
  • Predicate pushdown
  • parquet vs csv
  • what happens when we run Glue context?
  • is Spark context really need in gluecontext?
  • job got failed(not data skew, not memory), how do you fix it?

🏢 Stellantis 🏷️ PySpark #5 of 7

📝 Answer

Interviewer:
Can you explain job optimization techniques like data skew handling, predicate pushdown, and also compare Parquet vs CSV?
Candidate:
So basically, when I think about job optimization, I don’t just think about code… I think about how data flows and how much data we are processing. Let me start with data skew. Data skew happens when some keys have a huge amount of data compared to others. In one of my projects, I was joining data on a column like “city”, and one city had a huge number of records. Because of that, one partition became very heavy and slowed down the job. So what I did was… I applied salting technique. I added a random key to distribute the data more evenly across partitions. That improved performance significantly. Now coming to predicate pushdown. So basically, predicate pushdown means filtering data as early as possible at the source level. For example, instead of reading the full dataset and then applying a filter, I push the filter condition down so that only required data is read. In my Glue jobs, I used pushdown predicates while reading from S3 or catalog tables. That reduced I/O and improved performance. Now Parquet vs CSV. CSV is row-based and does not store schema or metadata efficiently. It’s simple but not optimized for performance. Parquet is columnar. It stores data in columns and supports compression and encoding. In my ETL pipelines, I always convert CSV to Parquet. This reduces storage and speeds up queries because only required columns are read. So basically, for production workloads, Parquet is always better than CSV.
Interviewer:
What happens when we use GlueContext? Is SparkContext really required?
Candidate:
So this is something I understood when I started working with Glue. GlueContext is basically a wrapper around SparkContext. It provides additional features specifically for AWS Glue, like DynamicFrames, integration with Data Catalog, and schema handling. When we initialize GlueContext, internally it uses SparkContext. So yes, SparkContext is required, but we don’t directly interact with it most of the time. In my projects, I mostly used GlueContext because it simplifies reading from catalog tables and handling semi-structured data. But whenever I needed advanced transformations, I converted DynamicFrame to DataFrame and used Spark operations. So basically, GlueContext makes things easier, but SparkContext is still the core engine underneath.
from pyspark.context import SparkContext
from awsglue.context import GlueContext

sc = SparkContext()
glueContext = GlueContext(sc)
Interviewer:
Suppose your job failed, but it’s not due to data skew or memory issues. How would you debug and fix it?
Candidate:
So basically, this is a real production scenario, and I’ve faced this multiple times. First, I don’t assume anything. I go step by step. First, I check CloudWatch logs. That gives me the exact error message. In one case, my job failed due to schema mismatch. New data had an extra column, and the job was not able to process it. So I fixed it by handling schema evolution properly. Another time, the issue was with permissions. The Glue job didn’t have access to the S3 bucket. So I updated the IAM role. Sometimes, the issue is with bad data. For example, null values or unexpected formats causing transformation errors. In such cases, I add validation and error handling logic. Also, I check dependencies. Sometimes external libraries in the job are missing or incompatible. One important practice I follow is adding proper logging at each step. That helps me quickly identify where exactly the job failed. So basically, my approach is… check logs, identify root cause, and fix based on whether it’s schema, permissions, data quality, or dependency issues. One key lesson I learned is… most failures are not due to performance, but due to data or configuration issues.
Interviewer (Follow-up):
Good. Can you explain how you would handle schema evolution in a Glue job?