-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Enforce predictable order for first() and last() #3823
Conversation
@otoolep may be a silly question but does the test fail without the fix? |
@dgnorton -- yes it does. Sometimes it passes, sometimes it doesn't. Without the fix:
|
Failed first time, passed second time. |
+1 |
8276764
to
405ee97
Compare
@pauldix has agreed that the behaviour should be deterministic. I will profile this and if this change is not a problem I will merge. |
The impact of this change is significant. With our stress tool |
|
405ee97
to
a6bb4fe
Compare
Some other ideas: -- |
The general agreement is however that a 20-30% query hit across the board is not acceptable just to deal with this edge-case. |
If 2 or more points during this map-and-reduce share the same timestamp, the tie is broken by looking at the value. This ensures that these functions operate in a deterministic manner. This solution due to @jwilder
a6bb4fe
to
10779c9
Compare
With this change we now only take the hit for last and first queries, and this is desired functionality. |
+1 |
Enforce predictable order for first() and last()
When two or more points have the same timestamp during first() and last() aggregations, the tie is broken by taking the one with the larger value.
Solution thanks to @jwilder