You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RQL Proposal: Make Between not use null to denote unboundedness #1023
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...
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).)
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.
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?
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.)
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.
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?
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.)
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.
Activity
coffeemug commentedon Apr 7, 2014
Moving to 1.13-polish because this needs to be done along with #1032.
@mlucy proposed adding
r.minvalandr.maxval. That sounds reasonable to me (though perhaps we can find better names).srh commentedon Apr 7, 2014
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.
mlucy commentedon Apr 7, 2014
I sort of don't like
r.unbounded, because it doesn't make sense outside the narrow language ofbetween. (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).)srh commentedon Apr 8, 2014
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.
mlucy commentedon Apr 9, 2014
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 forr.maxval.)Better names would of course be wonderful; anyone have any good ideas?
srh commentedon Apr 9, 2014
Okay, so the names make sense if you're proposing supporting actual operations on
r.minvalandr.maxvalthat make them actual comparable types.What is the full set of operations they support? Comparisons, yes. Will
array.add(r.minval).max()returnr.minvalifarrayis empty?mlucy commentedon Apr 9, 2014
Maybe? Would it be crazy if
r.minvalandr.maxvalwere 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 + 5would throw because we'd try to interpret it as a number.)neumino commentedon Apr 9, 2014
It would be simpler to just allow them in comparisons like we allow
r.asc/desconly inorderBy.mlucy commentedon Apr 9, 2014
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.
srh commentedon Apr 9, 2014
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?
mlucy commentedon Apr 9, 2014
It would have to be a
datum_ttype to be storable in an array. If we just prohibited serializing it anywhere except for the endpoint of a range,betweenwould still work. (Also, the notation was ambiguous because I was doing Ruby's thing where functions of no arguments lack parentheses, but I thinkr.maxvalshould be a function. Then you could send functions to the shards that includer.maxval()in their code without the result ofr.maxval()needing to be serializable.)mlucy commentedon Apr 9, 2014
Or maybe that's crazy, actually.
44 remaining items
AtnNn commentedon Mar 5, 2015
@Tryneus: in the Data Explorer I get
AtnNn commentedon Mar 5, 2015
My bad. It should be
r.minvalnotr.minval().gchpaco commentedon Mar 6, 2015
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.
gchpaco commentedon Mar 6, 2015
CR 2693.
adding regression test for issue #1023
adding regression test for issue #1023
Merge branch 'gchpaco_1023' into next
adding regression test for issue rethinkdb#1023
adding regression test for issue rethinkdb#1023