Skip to content

PartialOrd, Addition and Subtraction support for Interval Types #5412

Description

@berkaysynnada

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Currently, comparison operators are not supported for different kinds of intervals (such as IntervalYearMonth vs IntervalDayTime). We cannot add or subtract interval types also. They can be supported by making some arithmetic calculations.

Describe the solution you'd like

impl PartialOrd for ScalarValue {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        use ScalarValue::*;
        // This purposely doesn't have a catch-all "(_, _)" so that
        // any newly added enum variant will require editing this list
        // or else face a compile error
        match (self, other) {

These match arms can be extended to handle the required comparisons.

impl_op macro's match arms can be extended to support addition and subtraction.

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions