Comments (5)
The problem here is that the order of arguments to merge matters. The reason Joe did r.merge(..., x) instead of x.merge(...) in #43 is that otherwise it would clobber the field "rating". So we actually have two commands: a left-preferential mapped merge and a right-preferential mapped merge.
from rethinkdb.
Right, I missed that. We could do two commands or a flag/enum (which I personally prefer).
from rethinkdb.
I think that having a command to merges on streams isn't quite what we want. It would still be a bit unwieldy to use it for defaults in pluck which is the impetus for this bug I believe. Using this command you could do:
table.left_merge({"foo": 0, "bar" : 0}).pluck("foo", "bar")
which is definitely an improvement over a map but I'd like to have the defaulting built right in to the pluck so I could do:
table.pluck(["foo", 0], ["bar", 0])
Which just feels cleaner to me. Once we have defaulting sugar in the places we want it I don't think that a stream merge command is really useful enough to justify the sugar. If I heard about merge on a stream my first guess as to what it did wouldn't be the above behavior it would be merge sorting 2 streams together.
from rethinkdb.
I don't think we should call it 'merge' or even 'left_merge'. Perhaps 'defaults' or 'unpluck'? I think such a command would be very useful, even if we did provide defaults everywhere else.
Also, the pluck(['foo', 0], ['bar', 1], 'baz')
api seems pretty ugly to me. Perhaps pluck('foo', 'bar', 'baz', default=null)
? A little less powerful, but seems much cleaner. If the user wants the more advanced version, they can use defaults
instead.
from rethinkdb.
Since merge is now polymorphic, this is effectively done (one can call merge on an object or a stream -- I actually found it to be pretty convenient in practice). Closing.
from rethinkdb.
Related Issues (20)
- Add "Buffers" from /proc/meminfo in parse_meminfo_file to determine available memory
- download.rethinkdb.com is down, 502 Bad Gateway HOT 1
- Evaluate Profile-Guided Optimization (PGO) on RethinkDB
- error: to_string called on an uninitialized ip_address_t, addr_type: 0 compiling rethinkdb on Raspberry HOT 6
- RethinkDB not fully supported on Raspberry PI OS Bullseye (32/64 bit) HOT 10
- Reasonable to change hard-coded cluster size? HOT 5
- help bro my issue = warn: Problem when checking for new versions of RethinkDB: HTTP request to update.rethinkdb.com failed. HOT 1
- cluster connect/reconnect timeout HOT 1
- Installation fails in Kubuntu 23.10 HOT 4
- Generate web_assets.cc in a repeatable file order HOT 1
- Avoid full paths of coffeescript files in generation of web_assets.cc HOT 2
- Rethinkdb 2.4.4 release list HOT 11
- Support protobuf 25
- Return multiple changes feed
- Cache miss rate measurements HOT 4
- Something i forgot to had when having the default doc like so
- Connect rethinkdb directly from browser ? HOT 1
- Why exactly do rethinkDB add null characters to response / request JSON ? HOT 5
- I could not install RethinkDB in Ubuntu 24.04 HOT 1
- How to handle NaN error in javascript Driver? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rethinkdb.