You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently adding/subtracting intervals results in an interval with a unit of the left operand. This can result in accidental information loss if the smaller unit in the operation is the right operand:
In [1]: importibisIn [2]: one_second=ibis.interval(seconds=1)
In [3]: two_minutes=ibis.interval(minutes=2)
In [4]: (one_second+two_minutes).type().unitOut[4]: <IntervalUnit.SECOND: 's'>In [5]: (two_minutes+one_second).type().unit# I'd expect seconds here tooOut[5]: <IntervalUnit.MINUTE: 'm'>In [6]: (one_second+two_minutes).execute()
Out[6]: Timedelta('0 days 00:02:01')
In [7]: (two_minutes+one_second).execute() # the second is dropped on rounding to minutesOut[7]: Timedelta('0 days 00:02:00')
The offending code is here. With some pointers I can probably fix this. I know we have casting utilities for handling integer upcasting, but I'm not sure if the same exists for intervals.
What version of ibis are you using?
dev
What backend(s) are you using, if any?
No response
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
What happened?
Currently adding/subtracting intervals results in an interval with a unit of the
leftoperand. This can result in accidental information loss if the smaller unit in the operation is the right operand:The offending code is here. With some pointers I can probably fix this. I know we have casting utilities for handling integer upcasting, but I'm not sure if the same exists for intervals.
What version of ibis are you using?
dev
What backend(s) are you using, if any?
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: