ibis
ibis copied to clipboard
bug: IntervalValue property annotations do not match the actual return type of as_unit
What happened?
In ibis/expr/types/temporal.py, IntervalValue.as_unit() is annotated to return IntervalValue, yet every “unit” convenience property (years, quarters, months, weeks, days, hours, ...) is annotated to return ir.IntegerValue.
each property is implemented as:
@property def years(self) -> ir.IntegerValue: return self.as_unit("Y")
Possible fix: Either
- as_unit() should cast/convert to ir.IntegerValue when the caller asks for a scalar unit, or
- the return annotations on years, quarters, months, weeks, days, hours, and so on should be changed to IntervalValue.
What version of ibis are you using?
10.4.0
What backend(s) are you using, if any?
No response
Relevant log output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct