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
order by random sometimes crashes rethinkdb #5548
Comments
Thanks for the bug report @eden . I think we didn't consider the scenario of having a non-deterministic function to sort on when implementing As a work-around, you can do something like this: r.db('test').table('random').map(r.row.merge({"rand_ind": r.random()})).order_by("rand_ind").limit(1).without("rand_ind").run(conn) |
I think we should probably rewrite the in-memory |
We should probably disallow non-deterministic sorting functions; that seems a little clearer. |
Hi, I'm having an issue with sorting by random also. The stacktrace:
The query is quite complicated, used it while sifting through data, don't think any sane person should do this in production, but still...
|
@soplakanets it seems like the recommendation would be to merge in the random value in your map then sort on its value in the orderBy making the result of the sort predicate deterministic. I think the RethinkDB documentation should be updated to at least call out the degenerate behavior with non-deterministic functions. |
@eden Thank you very much. That was easy, should have figure that out myself :) +1 for updating docs. |
This is fixed in next. |
When ordering rows by the result of
r.random()
, rethinkdb sometimes crashes. Below is a stack trace and sample script. This only repros on Linux and did not repro when I ran it locally on my Mac.The text was updated successfully, but these errors were encountered: