Interview practice question
Dates shifting by a day after processing
Data Engineering · Spark · Beginner
After a Spark job, some timestamps converted to dates are shifted by one day compared to the source. Why?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Spark's session time zone affects timestamp conversions.
- Source timestamps may be in a different zone or have no zone.
- Set spark.sql.session.timeZone explicitly, usually UTC.
- Convert to local zones explicitly with from_utc_timestamp.
- Test with values near midnight.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.