Skip to content

RQL Proposal: Make Between not use null to denote unboundedness #1023

Closed

Description

@mlucy

See issue #1001.

Activity

  1. modified the milestones: , backlog on Apr 7, 2014
  2. coffeemug commented on Apr 7, 2014

    @coffeemug
    Contributor

    Moving to 1.13-polish because this needs to be done along with #1032.

    @mlucy proposed adding r.minval and r.maxval. That sounds reasonable to me (though perhaps we can find better names).

  3. srh commented on Apr 7, 2014

    @srh
    Contributor

    Between uses a half-open interval, and .between(r.minval, r.maxval) implies that r.maxval isn't included in the range. This annoys me. It's much slicker than r.positive_infinity and r.negative_infinity though...

    How about one name? r.unbounded.

  4. mlucy commented on Apr 7, 2014

    @mlucy
    MemberAuthor

    I sort of don't like r.unbounded, because it doesn't make sense outside the narrow language of between. (It's also less useful for compound indexes. For a non-compound index, if you want all x s.t. a < x < b, you can write .between(a, b, left_bound:'open'). If we had separate minval and maxval, you could write .between([a, r.maxval], [b, r.minval], index:'compound') to get the same behavior on the first field of the compound index (whereas .between([a, r.unbounded], [b, r.unbounded], {index:'compound', lef_bound:'open'}) wouldn't work).)

  5. srh commented on Apr 8, 2014

    @srh
    Contributor

    Okay. But we should still think of better names, because r.minval would compare less than the minimum value, and r.maxval would compare greater than every value.

  6. mlucy commented on Apr 9, 2014

    @mlucy
    MemberAuthor

    Err...I don't quite follow. r.minval == r.minval, so it isn't less than the minimum value, it's less than every other value. (Same in reverse for r.maxval.)

    Better names would of course be wonderful; anyone have any good ideas?

  7. srh commented on Apr 9, 2014

    @srh
    Contributor

    Okay, so the names make sense if you're proposing supporting actual operations on r.minval and r.maxval that make them actual comparable types.

    What is the full set of operations they support? Comparisons, yes. Will array.add(r.minval).max() return r.minval if array is empty?

  8. mlucy commented on Apr 9, 2014

    @mlucy
    MemberAuthor

    Maybe? Would it be crazy if r.minval and r.maxval were normal values that could be compared, and only threw if you tried to return them to the user or interpret them as another value? (E.g. r.minval + 5 would throw because we'd try to interpret it as a number.)

  9. neumino commented on Apr 9, 2014

    @neumino
    Member

    It would be simpler to just allow them in comparisons like we allow r.asc/desc only in orderBy.

  10. mlucy commented on Apr 9, 2014

    @mlucy
    MemberAuthor

    Well, to support compound indexes we have to support putting them into and getting them out of arrays. So we'd have to explicitly disallow things like r([r.maxval]).max.

    Implementation-wise, the more they behave like "real" values the easier things are.

  11. srh commented on Apr 9, 2014

    @srh
    Contributor

    Would they be represented as a type of datum_t? What if somebody tries to store an r.maxval? We need code to prevent that. Would this be a new problem or is that something we already worry about with other datum_t values?

  12. mlucy commented on Apr 9, 2014

    @mlucy
    MemberAuthor

    It would have to be a datum_t type to be storable in an array. If we just prohibited serializing it anywhere except for the endpoint of a range, between would still work. (Also, the notation was ambiguous because I was doing Ruby's thing where functions of no arguments lack parentheses, but I think r.maxval should be a function. Then you could send functions to the shards that include r.maxval() in their code without the result of r.maxval() needing to be serializable.)

  13. mlucy commented on Apr 9, 2014

    @mlucy
    MemberAuthor

    Or maybe that's crazy, actually.

  14. 44 remaining items

  15. AtnNn commented on Mar 5, 2015

    @AtnNn
    Member

    @Tryneus: in the Data Explorer I get

    >>> r.minval()
    RqlDriverError: Expected 1 argument but found 0.
    
  16. AtnNn commented on Mar 5, 2015

    @AtnNn
    Member

    My bad. It should be r.minval not r.minval().

  17. reopened this on Mar 6, 2015
  18. gchpaco commented on Mar 6, 2015

    @gchpaco
    Contributor

    Derp, I should have chimed in earlier. These terms did not get added to the pretty printer's list of non-stringable terms, so they'll come out all stupid. Reopening and assigning to myself.

  19. assigned and unassigned on Mar 6, 2015
  20. gchpaco commented on Mar 6, 2015

    @gchpaco
    Contributor

    CR 2693.

  21. added 3 commits that reference this issue on Aug 7, 2026
    bcfc945
    66def28
    a98194e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions