Open timsaucer opened 1 month ago
This seems like a very easy fix. I think we just match on order_by.is_some() and pick the appropriate default. To close, I think at a minimum we would want (1) a unit test to cover both options and (2) text in the window
function that describes this behavior.
Based on recommendation on discord, we may want to use WindowFrame::new()
which has the logic already for checking if order_by exists.
From @Michael-J-Ward
Doing a little archaelogy on that:
This is the PR where window_frame switched from None to WindowFrame::new(order_by.is_some());
The PR discussion has some talk on test regressions related to it.
Describe the bug When no window frame is specified in the python implementation, we default to unbounded preceeding to current row. If we are to follow PostgreSQL implementation then we should set this value when
order_by
is specified and otherwise default to unbounded preceeding to unbounded following.To Reproduce
Produces:
Expected behavior When
order_by
is not specified, default to unbounded preceeding to unbounded following.Additional context The offending line of code appears to be here:
https://github.com/apache/datafusion-python/blob/main/src/functions.rs#L230