Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the PostgreSQL 'empty' range that's distinct from the (,) infinite range #492

Closed
nstdio opened this issue Oct 2, 2022 · 1 comment
Assignees
Milestone

Comments

@nstdio
Copy link
Contributor

nstdio commented Oct 2, 2022

When mapping PostgreSQL empty range we are creating Range objects which is actually unbounded from both sides. The created range has exact internal structure that Range.integerRange("(infinity,infinity)") would have.

Here is the quote from documentation:

...
Notice that the final pattern is empty, which represents an empty range (a range that contains no points).

So it'll be sensible to align with this semantics in Java as well.

Currently following test case test case fails:

    @Test
    public void emptyRangeWithEmptyKeyword() {
        Range<LocalDate> empty = Range.localDateRange("empty");

        assertFalse(empty.contains(LocalDate.MIN));
        assertFalse(empty.contains(LocalDate.now()));
        assertFalse(empty.contains(LocalDate.MAX));

        assertNull(empty.upper());
        assertNull(empty.lower());
    }

@vladmihalcea can you please assign this issue to me? I've already started working this.

nstdio added a commit to nstdio/hibernate-types that referenced this issue Oct 2, 2022
nstdio added a commit to nstdio/hibernate-types that referenced this issue Oct 2, 2022
nstdio added a commit to nstdio/hibernate-types that referenced this issue Oct 2, 2022
nstdio added a commit to nstdio/hibernate-types that referenced this issue Oct 2, 2022
@vladmihalcea vladmihalcea changed the title Empty range is actually infinite. Empty range ic currently equivalent to an Infinite range Oct 17, 2022
@vladmihalcea vladmihalcea changed the title Empty range ic currently equivalent to an Infinite range Empty Range is currently equivalent to an Infinite range Oct 17, 2022
@vladmihalcea vladmihalcea changed the title Empty Range is currently equivalent to an Infinite range Add support for the PostgreSQL 'empty' range that's distinct from the (,) infinite range Oct 17, 2022
@vladmihalcea vladmihalcea self-assigned this Oct 17, 2022
@vladmihalcea vladmihalcea added this to the 2.20.0 milestone Oct 17, 2022
@vladmihalcea
Copy link
Owner

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants