Aditya Manuja
Back to projects

Correctness in DuckDB

I fixed a position calculation in DuckDB that could raise an internal error when a SQL window frame started after the current row.

View pull request C++ / SQL / Open source
Current row and future window Illustrative SQL window

The edge case

An ordered window frame can contain only rows after the current row. In that case, the position calculation could underflow and cause an internal error.

The fix and tests

I clamped relative positions to the frame bounds and added regression coverage for frames before and after the current row. The pull request contains the change and its regression coverage.