49. Forward-Fill Missing Readings
Difficulty: Hard · Topics: Window Functions
An advanced problem: unlock it to open the statement, sample data and editor. Graded on 3 test cases.
Learn the concepts
- rangeBetween · 6 min read. Window frames by value instead of row count: the last 7 calendar days, not the last 7 rows.
- last(ignorenulls) · 4 min read. Forward-fill missing values with last over a window, and the frame that makes it work.
- row_number / rank · 4 min read. Number and rank rows inside a window, and how the three ranking functions treat ties.
PySpark functions you'll practise
- Window spec
- Rows Between
- last
- withColumn
- orderBy
Related problems
- Three-Day Login Streak · Hard · Window Functions, Aggregations, Dates, Filtering & Selection
- Trailing 3 Calendar Days (Range Frame) · Hard · Window Functions, Dates, Filtering & Selection
- Sessionize a Clickstream · Hard · Window Functions, Dates, Null Handling, Conditional Logic, Filtering & Selection
- Consecutive Status Runs (Gaps and Islands) · Hard · Window Functions, Aggregations
- Build an SCD Type 2 History · Hard · Window Functions, 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