PySpark Arrays
6 interview problems on split, explode and work with array columns, from easy to hard.
Learn Arrays
- explode · 4 min read. Turn each array element into its own row, and the rows explode silently drops.
- Array functions · 4 min read. array_contains, size, element_at, sort_array and the set functions, without exploding.
- collect_list / collect_set · 4 min read. Gather the values of a group into an array, with or without duplicates, and in which order.
- posexplode · 3 min read. Explode an array and keep each element position, plus the _outer variant that keeps empty arrays.
- Word Count · Medium · Arrays, Aggregations, Strings, Filtering & Selection
- Item Positions in a Basket (POSEXPLODE) · Medium · Arrays, Filtering & Selection
- Keep Users with No Interests (EXPLODE_OUTER) · Medium · Arrays, Filtering & Selection
- Sorted Distinct Purchase List · Medium · Arrays, Aggregations
- Learning Path per Student · Medium · Arrays, Aggregations, Strings, Filtering & Selection
- Fill Missing Dates (Calendar Spine) · Hard · Joins, Arrays, Aggregations, Dates, Null Handling, Filtering & Selection
Browse
Topics: Window Functions · Joins · Aggregations · Pivot, Unpivot & Rollup · Arrays · Null Handling · Conditional Logic · Dates · Filtering & Selection · Strings · Data Lake · Lakehouse · Streaming · Data Prep for AI · Spark Performance
Difficulty: Easy · Medium · Hard · Learn · All problems · dbt practice