rescrv / HyperDex

HyperDex is a scalable, searchable key-value store
http://hyperdex.org
BSD 3-Clause "New" or "Revised" License
1.4k stars 166 forks source link

boolean datatype #159

Open mwotton opened 10 years ago

mwotton commented 10 years ago

also a nice-to-have, I suppose.

rescrv commented 10 years ago

I don't know that I'll be adding a boolean datatype. The C programmer in me says "int" is good enough, and avoiding the additional code complexity of adding a "bool" trumps having meaningfully distinct types. We're adding support for JSON objects, so you can use bool types there.

mwotton commented 10 years ago

""" The New Jersey guy said that the Unix solution was right because the design philosophy of Unix was simplicity and that the right thing was too complex. Besides, programmers could easily insert this extra test and loop. The MIT guy pointed out that the implementation was simple but the interface to the functionality was complex. The New Jersey guy said that the right tradeoff has been selected in Unix-namely, implementation simplicity was more important than interface simplicity.

The MIT guy then muttered that sometimes it takes a tough man to make a tender chicken, but the New Jersey guy didn't understand (I'm not sure I do either). """

:) but it's your project.

rescrv commented 10 years ago

I'll reconsider, but I don't know that there's much that can be gained. Maybe if the implementation was different than simply a copy of "int", there'd be an advantage to having that additional complexity. As it stands, the bool data type will be functionally identical to int, with the same interface at the C level.

SA_RESTART has been around for quite some time, and completely sidesteps the NJ/MIT debate. If we waited for the MIT guy to get everything 100% right from the get-go, we'd probably have the perfect OS a decade from now, with nothing usable until then.

AaronFriel commented 10 years ago

What might be more worth the time to change the API would be a bitvector. As a data type, it has more interesting atomic operations and use cases. It also means if people want to store lots of boolean values, they can and it'll be appropriately sized in the database.

If ops allowed passing a list of indices to set, a list of indexes to return the "AND" or "OR" of, or retrieve an individual bit, you can implement a distributed bloom filter. Bool would just be an alias for the case of a length 1 vector and only support get/set.

Dretch commented 9 years ago

+1

I would like boolean fields to show up as true/false in tools/admin-interfaces.