ibis
ibis copied to clipboard
bug(api): windows do not accept expressions for bounds
Right now the following lines of code do not work:
import ibis
ibis.range_window(following=(ibis.interval(seconds=1), None))
ibis.window(following=(ibis.literal(1), None))
with this traceback:
Traceback (most recent call last):
File "/home/cloud/src/ibis/timeseries.py", line 3, in <module>
ibis.range_window(following=(ibis.interval(seconds=1), None))
File "/home/cloud/src/ibis/ibis/expr/window.py", line 393, in range_window
return Window(
File "/home/cloud/src/ibis/ibis/expr/window.py", line 134, in __init__
self._validate_frame()
File "/home/cloud/src/ibis/ibis/expr/window.py", line 188, in _validate_frame
if start < 0:
File "/home/cloud/src/ibis/ibis/expr/types.py", line 54, in __bool__
raise ValueError(
ValueError: The truth value of an Ibis expression is not defined
We have an assumption that the bounds of a window are constants, and that is an incorrect assumption. We need to allow arbitrary expressions in and let the individual backends reject invalid code. There's no feasible, maintainable static analysis we can do here given the need to allow expressions in window bounds.