Skip to content

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

Open
@daniel-bale

Description

@daniel-bale

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

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior inside of ibis

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions