Determines whether the end bound calculation for a window frame context is
safe, meaning that the end bound stays the same, regardless of future data,
based on the current sort expressions and ORDER BY columns. This function
delegates work to specific functions for each frame type.
For group-based window frames, determines whether the end bound calculation
is safe by considering the group offset and whether the current row is ahead
of the most recent row in terms of sorting. It checks if the end bound is
within the bounds of the current group based on group end indices.
For row-based window frames, determines whether the end bound calculation
is safe by comparing it against specific values (zero, current row). It uses
the is_row_ahead helper function to determine if the current row is ahead
of the most recent row based on the ORDER BY column and sorting options.
For row-based window frames, determines whether the end bound calculation
is safe, which is trivially the case for Preceding and CurrentRow bounds.
For โFollowingโ bounds, it compares the bound value to zero to ensure that
it doesnโt extend beyond the current row.