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
Proposal: change the behavior of secondary indexes wrt NULLs #1001
Comments
Note that if I just used filter, I'd write this: |
This is more of a Also, as an aside, making a secondary index with What you really want here is |
Ah, noted on not being able to get all the rows that do :( We should probably close this proposal then. However, I don't see what it has to do with |
I thought we had a rule that index (only primary?) keys could not be null. This is what allows us to use null for empty endpoint in between. If secondary index keys can be null but between is supposed to work on secondary indexes then we already can't use nulls to denote empty endpoints. This is an inconsistency that we have to fix one way or the other. Given that we decided to go the route that null generally means nonexistence then @coffeemug's original proposal makes total sense. Returning null in the secondary index function means "don't include in the index". @mlucy why does the query have to be |
On Thu, Jun 13, 2013 at 3:11 AM, wmrowan notifications@github.com wrote:
|
@wmrowan -- that works fine. @coffeemug -- we currently disallow |
Using null as a special value in between is just generally a bad idea, we
|
I dunno, we seem to be moving away from using |
I'm strongly in favor of having null as a valid value and change the behavior of between. Using null to represent unboudedness is just bad design. |
@neumino -- what signature would you like instead? |
between(r.open, r.open) would work for me.
|
One moment ya'll -- I was just talking about changing the behavior of The issue of |
We shouldn't drop rows when the secondary index is I expect
to return exactly the same results as
Whatever the value of The syntax of @jdoliner would work for me. |
@jdoliner -- I really don't like our new trend toward introducing terms that are only valid inside of one specific other term. It feels really hacky and ugly (although @neumino -- the advantage of Slava's proposal would be that creating an index on an attribute would have exactly the same behavior if that attribute is |
We could have For the rest, I still don't see a valid reason not to let people use |
It seems like there's no getting around some added complexity here I find
Since we seem robe discussing 2 issues in one thread here I'll now address On Friday, June 14, 2013, Michel wrote:
|
As far as table.between() # returns everything
table.between(start = 'bar') # returns everything after 'bar'
table.between(end = 'foo') # returns everything before 'foo'
table.between(start = 'bar', end = 'foo') # returns everything between 'bar' and 'foo' This seems ok to me. However, if we end up not allowing nulls in secondary indexes, I don't see what's wrong with jut passing As for nulls in sindexes, I don't think either solution had a strong proponent. As far as I recall, we wobbled between available options and picked the one currently implemented (which I agree with at the time). I now think we picked the wrong one in light of treating null as non-existence. |
@coffeemug What you just described for between is what we originally implemented. We switched it for 1.5 because we thought the optional argument approach was clunky: |
@mlucy What alternative do you think is best? |
Alright, here's what I think we should do:
As for what I think we should do about |
@mlucy I didn't get why you think having null in the secondary index is confusing. What's confusing? |
Mostly because it would be yet another case where Actually, it turns out that we already exclude |
This is in review 642 by @Tryneus . |
This is in next. Closing because the original issue is satisfied (or rather, it turns out we were doing that all along). @neumino -- if you still think we should allow |
I was writing up an explanation of how to use secondary indexes to match regexes and I followed my intuition and wrote this:
I expected the between call to return only the documents where
first_name
starts withS
, but instead it returned everything because we includenull
into the secondary index. I had to rewrite the query as follows to actually work:I think we picked behavior of secondary indexes wrt NULLs and should change it to exclude NULLs. That seems a lot more natural to me.
The text was updated successfully, but these errors were encountered: