ibis icon indicating copy to clipboard operation
ibis copied to clipboard

bug: IntervalValue property annotations do not match the actual return type of as_unit

Open daniel-bale opened this issue 6 months ago • 0 comments

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

  1. as_unit() should cast/convert to ir.IntegerValue when the caller asks for a scalar unit, or
  2. 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

daniel-bale avatar Jun 05 '25 03:06 daniel-bale