v.23.5Improvement

Extend first_value and last_value to Accept NULL

Extend first_value and last_value to accept NULL. #46467 (lgbo).
Extend first_value and last_value window functions to accept NULL values.

Why it matters

Previously, the first_value and last_value window functions did not handle NULL input values, limiting their usability in scenarios where NULLs are present. This enhancement allows these functions to process and return NULLs correctly, improving accuracy and flexibility when working with datasets containing NULL entries.

How to use it

Users can now directly use first_value and last_value in their SQL queries as before. These functions will properly handle NULL values without additional configuration or changes in syntax. For example:
SELECT first_value(column_name) OVER (PARTITION BY col ORDER BY col2) FROM table

will now correctly consider NULLs within the window frame.